What is the MOST cost-effective way to do this?
Build a pipeline in AWS CodePipeline to download and save the latest operating system Open Virtualization Format (OVF) image to an Amazon S3 bucket. Customize the image by using the guestfish utility. Use the virtual machine (VM) import command to convert the OVF to an AMI. Store the AMI identification output as an AWS Systems Manager Parameter Store parameter.
Create an AWS Systems Manager Automation runbook with values instructing how the image should be created. Build a pipeline in AWS CodePipeline to execute the runbook to create the AMI. Store the AMI identification output as a Systems Manager Parameter Store parameter.
Build a pipeline in AWS CodePipeline to take a snapshot of an Amazon EC2 instance running the latest version of the application. Start a new EC2 instance from the snapshot and update the running instance by using an AWS Lambda function. Take a snapshot of the updated instance and convert it to an AMI. Store the AMI identification output in an Amazon DynamoDB table.
Launch an Amazon EC2 instance and install Packer. Configure a Packer build with values defining how the image should be created. Build a Jenkins pipeline to invoke the Packer build to create an AMI. Store the AMI identification output in an Amazon DynamoDB table.
Explanations:
This option involves downloading an OVF image and converting it to an AMI, which is a complex process and not the most efficient way to create an AMI from an existing EC2 instance. Additionally, using guestfish for customization adds unnecessary complexity, and the approach to storing the AMI ID in Systems Manager Parameter Store is valid but does not justify the overall process complexity and cost.
Using AWS Systems Manager Automation to create an AMI provides a straightforward and cost-effective solution. The automation runbook can define how the AMI should be created, and invoking it via CodePipeline integrates well into a CI/CD pipeline. Storing the AMI ID in Systems Manager Parameter Store allows for easy access by other services and pipelines, making it a clean solution.
This option describes a more manual approach that requires taking snapshots and updating instances through a Lambda function, which introduces additional complexity and potential failure points. Storing the AMI ID in a DynamoDB table, while possible, adds unnecessary cost and complexity compared to using Systems Manager Parameter Store.
This option suggests using Packer and Jenkins, which introduces additional tools and complexity that are not necessary for creating an AMI. While it is a valid method, it is not the most cost-effective as it involves maintaining additional infrastructure (Jenkins) and does not streamline the process as effectively as using Systems Manager Automation. The DynamoDB storage adds further cost and complexity.