An enterprise is planning to deploy a new version of a critical monolithic web application running on Amazon EC2 instances in an Auto Scaling group (ASG) behind an Application Load Balancer (ALB). The infrastructure is managed using AWS CloudFormation. The deployment process must meet the following requirements:
- Shift exactly of production traffic to the new version initially.
- Route the remaining of traffic to the new version only after a 15-minute evaluation period.
- Perform an immediate and automatic rollback to the previous version with zero downtime if the HTTP 5xx error rate on the new version exceeds during the evaluation period.
- Ensure no configuration changes are made to the existing EC2 instances during the deployment, keeping the update fully immutable.
Which deployment strategy should a Solutions Architect design to meet these requirements with the least operational complexity?
- Provision a new Auto Scaling group running the new application version using AWS CloudFormation. Configure the Application Load Balancer with two target groups: one pointing to the existing Auto Scaling group and one pointing to the new Auto Scaling group. Use an AWS Lambda function triggered by AWS CodePipeline to update the ALB listener rule weights, routing of traffic to the new target group. Monitor the new target group with an Amazon CloudWatch alarm, and configure CodePipeline to revert the weights to on the existing target group if the alarm triggers.Answer
- BConfigure AWS CodeDeploy to perform a Blue/Green deployment using the existing Auto Scaling group as the primary environment and a newly provisioned Auto Scaling group as the replacement environment. Create a custom deployment configuration in CodeDeploy using a canary traffic-shifting policy set to route of traffic to the replacement environment for 15 minutes. Associate an Amazon CloudWatch alarm with the deployment group to trigger an automatic rollback if HTTP 5xx errors exceed the threshold.
- CUpdate the AWS CloudFormation template to modify the Amazon Machine Image (AMI) of the existing Auto Scaling group. Configure the CloudFormation update policy to use an AutoScalingRollingUpdate policy, setting MaxBatchSize to and MinInstancesInService to . Set the PauseTime to 15 minutes, and configure an Amazon CloudWatch alarm on the ALB 5xx metrics to roll back the CloudFormation stack if errors occur.
- DUse AWS CodeDeploy to perform an In-place deployment on the existing Auto Scaling group using the CodeDeployDefault.OneAtATime configuration. Configure the deployment group to use the Application Load Balancer to route traffic, and configure an Amazon CloudWatch alarm for ALB 5xx errors to trigger an automatic rollback. Implement a 15-minute block in the AppSpec file's AfterInstall hook to evaluate the performance of the first updated instance before proceeding.