Q97 — AWS DOP-C02 Ch.2
Question 97 of 100 | ← Chapter 2
A DevOps engineer wants to automate the creation of Linux AMIs. Newly created AMIs must be tagged, and the build pipeline must programmatically access the location of the newly tagged AMI. What is the most cost-effective method to perform this operation?
- A. Build a pipeline in AWS CodePipeline to download the latest OS Open Virtualization Format (OVF) image and save it to an Amazon S3 bucket. Customize the image using the guestfish utility. Convert the OVF to an AMI using the VM import command. Store the AMI identifier output as an AWS Systems Manager Parameter Store parameter.
- B. Create an AWS Systems Manager Automation runbook containing instructions for creating the image. Build a pipeline in AWS CodePipeline to execute the runbook to create the AMI. Store the AMI identifier output as a Systems Manager Parameter Store parameter. ✓
- C. Build a pipeline in AWS CodePipeline to take a snapshot of an Amazon EC2 instance running the latest application version. Launch a new EC2 instance from the snapshot and use an AWS Lambda function to update the running instance. Take a snapshot of the updated instance and convert it to an AMI. Store the AMI identifier output in an Amazon DynamoDB table.
- D. Launch an Amazon EC2 instance and install Packer. Configure a Packer build with values defining how the image is created. Build a Jenkins pipeline to invoke the Packer build to create the AMI. Store the AMI identifier output in an Amazon DynamoDB table.
Correct Answer: B. Create an AWS Systems Manager Automation runbook containing instructions for creating the image. Build a pipeline in AWS CodePipeline to execute the runbook to create the AMI. Store the AMI identifier output as a Systems Manager Parameter Store parameter.
Explanation
Option B is the most cost-effective method. AWS Systems Manager Automation runbooks efficiently encapsulate image creation logic, and invoking them via CodePipeline is simple and direct. Storing the AMI identifier in Systems Manager Parameter Store enables easy, programmatic access by downstream pipelines without requiring additional infrastructure or complex integrations. In contrast, Option A involves cumbersome OVF handling and conversion; Option C introduces unnecessary Lambda and DynamoDB costs and complexity; Option D requires managing EC2 instances, installing Packer, and maintaining Jenkins—adding operational overhead and expense. Thus, Option B is optimal.