A company is designing the deployment pipeline for a new web application. The application will run on Amazon EC2 instances within an Auto Scaling group behind an Application Load Balancer (ALB). The infrastructure is provisioned using AWS CloudFormation. The team requires a deployment strategy that can route exactly of user traffic to the new version for testing. If any errors are detected, the deployment must immediately roll back all traffic to the old version. If the deployment is successful, all traffic must be shifted to the new version. The strategy must minimize both the time to roll back and the cost of keeping duplicate environments running after the deployment is complete.
Which deployment strategy meets these requirements?
- AProvision a second Auto Scaling group and a new ALB for the new application version. In Amazon Route 53, configure weighted routing policies for the application's domain name, setting a weight of for the new ALB and for the existing ALB. If errors occur, update the Route 53 weights to route of the traffic to the existing ALB.
- BConfigure the existing Auto Scaling group with a CloudFormation UpdatePolicy set to AutoScalingRollingUpdate. Configure the MaxBatchSize parameter to of the total instance count to ensure only a subset of instances are updated first. Define CloudFormation rollback triggers using Amazon CloudWatch alarms to automatically revert the stack update if errors are detected.
- Provision a second Auto Scaling group and a new ALB target group for the new application version. In the CloudFormation template, update the ALB listener rule to distribute traffic by assigning a weight of to the new target group and to the existing target group. After validating the deployment, update the CloudFormation template to set the weight of the new target group to , and then terminate the old Auto Scaling group and target group.Answer
- DConfigure AWS CodeDeploy to perform an in-place deployment to the existing Auto Scaling group using the CodeDeployDefault.OneAtATime deployment configuration. Attach CloudWatch alarms to the deployment group to trigger an automatic rollback to the previous application version if errors are detected.
Answer
Provision a second Auto Scaling group and a new Application Load Balancer target group, then use AWS CloudFormation to shift traffic weights on the listener rule from 90/10 to 0/100.
The correct strategy uses Application Load Balancer (ALB) weighted target groups. This allows the system to direct exactly of the live user traffic to the new Auto Scaling group and target group. Because the traffic shift happens at the load balancer layer, rollbacks can be performed instantaneously by updating the listener rule weights back to for the old target group. Once the deployment is verified, the old Auto Scaling group and target group can be deleted, ensuring that duplicate costs are minimized.
Step-by-Step Solution
Key Concept
Canary deployments using Application Load Balancer weighted target groups in AWS CloudFormation.
Estimated Time:2m 0s