Q61 — AWS DOP-C02 Ch.3
Question 61 of 100 | ← Chapter 3
• Multiple instances must remain available to serve traffic during deployment. • Traffic must remain balanced across instances, and instances must self-heal upon failure. • A new set of instances must launch automatically to deploy a new revision, requiring no manual configuration. • Traffic must be rerouted to half of the new instances at a time. • Deployment must succeed only if traffic is successfully rerouted to at least half of the new instances; otherwise, it must fail. • Temporary files generated during deployment must be deleted before traffic is routed to the new instance fleet. • Upon successful deployment completion, the original instances in the deployment group must be terminated immediately to reduce cost. How can a DevOps engineer meet these requirements?
- A. Use an Application Load Balancer with in-place deployments. Associate the Auto Scaling group with the deployment group. Enable the Auto Scaling group copy option and use CodeDeployDefault.OneAtATime as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group and delete temporary files using the AllowTraffic lifecycle hook in appspec.yml.
- B. Use an Application Load Balancer with blue/green deployments. Associate the Auto Scaling group and the Application Load Balancer target group with the deployment group. Enable the Auto Scaling group copy option, create a custom deployment configuration defining minimum healthy hosts as 50%, and assign it to the deployment group. Instruct AWS CodeDeploy to terminate the original instances in the deployment group and delete temporary files using the BeforeBlockTraffic lifecycle hook in appspec.yml.
- C. Use an Application Load Balancer with blue/green deployments. Associate the Auto Scaling group and the Application Load Balancer target group with the deployment group. Enable the Auto Scaling group copy option and use CodeDeployDefault.HalfAtATime as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group and delete temporary files using the BeforeAllowTraffic lifecycle hook in appspec.yml. ✓
- D. Use an Application Load Balancer with in-place deployments. Associate the Auto Scaling group and the Application Load Balancer target group with the deployment group. Enable the Auto Scaling group copy option and use CodeDeployDefault.AllAtOnce as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group and delete temporary files using the BlockTraffic lifecycle hook in appspec.yml.
Correct Answer: C. Use an Application Load Balancer with blue/green deployments. Associate the Auto Scaling group and the Application Load Balancer target group with the deployment group. Enable the Auto Scaling group copy option and use CodeDeployDefault.HalfAtATime as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group and delete temporary files using the BeforeAllowTraffic lifecycle hook in appspec.yml.
Explanation
The requirements mandate phased traffic shift (half-at-a-time), automatic scaling, health-based success criteria, pre-traffic cleanup, and post-deployment termination. Blue/green deployment with CodeDeployDefault.HalfAtATime satisfies the incremental traffic routing requirement. Associating both the Auto Scaling group and ALB target group ensures proper traffic routing and instance registration. Using BeforeAllowTraffic ensures temporary files are removed *before* traffic reaches new instances. Enabling Auto Scaling group copy automates provisioning of new instances. Finally, configuring CodeDeploy to terminate original instances after successful deployment meets the cost-optimization requirement. Option C fulfills all constraints precisely.