Q64 — AWS DOP-C02 Ch.2

Question 64 of 100 | ← Chapter 2

A company uses AWS CodeDeploy to automate software deployments. The deployment must meet these requirements: • Multiple instances must be available for communication during deployment; traffic must be load-balanced across them, and instances must auto-heal upon failure. • A new fleet of instances must launch automatically for deploying new revisions, without manual configuration. • Temporary files generated during deployment must be deleted before traffic is routed to the new fleet. • After successful deployment, original instances in the deployment group must be terminated immediately to reduce costs.

Correct Answer: C. Use Application Load Balancer and blue/green deployment. Associate the Auto Scaling group and Application Load Balancer target group with the deployment group. Use the 'Auto copy Auto Scaling group' option and use the CodeDeploy default deployment configuration. Instruct AWS CodeDeploy to terminate original instances in the deployment group and use the 'BeforeAllowTraffic' lifecycle hook in the application to delete temporary files.

Explanation

This question tests knowledge of AWS CodeDeploy deployment types and lifecycle hooks. Blue/green deployment creates a completely new fleet of instances, enabling zero-downtime updates, inherent auto-healing, and automatic scaling group replication. The 'BeforeAllowTraffic' lifecycle hook executes before traffic routing begins—ensuring temporary files are cleaned up prior to user access. Post-deployment, CodeDeploy automatically terminates the original fleet by default, satisfying cost optimization. Option C correctly combines ALB, target group association, and standard deployment configuration to fulfill all requirements.