Soru

Zorluk: OrtaDeployment Strategy Design

A company hosts a critical production application on Amazon EC2 instances in an Auto Scaling group behind an Application Load Balancer (ALB). The architecture team is designing a deployment pipeline to release application updates. The deployment strategy must maintain 100%100\% of the required system capacity at all times during the release. Additionally, the strategy must initially route exactly 10%10\% of live production traffic to the new version for a 10-minute verification period. If a connected Amazon CloudWatch alarm is triggered during this period, traffic must immediately shift back to the old version with zero downtime. Which deployment strategy meets these requirements?

  1. A
    Deploy the update using AWS CodeDeploy with a blue/green deployment type. Select the EC2 Auto Scaling group and apply the CodeDeployDefault.ECSCanary10Percent10Minutes deployment configuration, using the CloudWatch alarm to trigger an automatic rollback.
  2. B
    Deploy the update by updating the AWS CloudFormation template of the application stack using an AutoScalingRollingUpdate policy. Set MinInstancesInService to the current desired capacity and MaxBatchSize to 10%. Configure CloudFormation rollback triggers mapped to the CloudWatch alarm.
  3. Deploy a new Auto Scaling group containing the new version. Configure the ALB listener rule to route traffic using weighted target groups, directing 90% of traffic to the old target group and 10% of traffic to the new target group. Use an automation script to monitor the CloudWatch alarm, shifting traffic back to 100% on the old target group if the alarm fires, or completing the transition to 100% on the new target group after 10 minutes.Cevap
  4. D
    Deploy the update using AWS CodeDeploy with an in-place deployment type. Use the CodeDeployDefault.OneAtATime deployment configuration and configure a deployment lifecycle event hook to register new instances to a secondary target group with 10% weight.

Cevap

Deploy a new Auto Scaling group containing the new version, and configure the ALB listener rule with weighted target groups to route 90% of traffic to the old target group and 10% of traffic to the new target group. Use an automation script to monitor the CloudWatch alarm, reverting the weight to 100% on the old target group if the alarm fires, or transitioning 100% to the new target group after 10 minutes.
The correct answer utilizes ALB weighted target groups to perform a manual canary deployment between two separate Auto Scaling groups. This strategy satisfies the requirement to maintain 100%100\% capacity because the original Auto Scaling group remains fully provisioned during the test. Since the ALB can immediately adjust routing weights, any failure detected by the CloudWatch alarm can trigger an automation script (such as an AWS Lambda function) to revert the traffic weight to 100%100\% on the original target group instantly, ensuring zero downtime. This is necessary because AWS CodeDeploy does not natively support gradual traffic-shifting configurations (Canary/Linear) for EC2 workloads.

Adım Adım Çözüm

1
Provision a new Auto Scaling group (the green environment) and deploy the updated application version to it.
The new version is running on isolated instances with 100% of the original capacity still active and serving traffic in the old Auto Scaling group (the blue environment).
This guarantees that the active production environment remains untouched and fully capable of handling 100% load during the initial phase.
2
Modify the Application Load Balancer listener rules to use weighted target groups, routing 90%90\% of traffic to the blue target group and 10%10\% to the green target group.
Exactly 10%10\% of live production traffic is directed to the new version, while 90%90\% continues to go to the stable version.
This achieves the canary testing requirement under live production load without fully exposing the application to potential errors.
3
Monitor the environment using a CloudWatch alarm. If errors occur, immediately reset the ALB listener rule weights to send 100%100\% of traffic back to the blue target group. If the 10-minute window passes successfully, shift 100%100\% of traffic to the green target group and decommission the blue environment.
A failed deployment is rolled back instantly with zero downtime, or a successful deployment is completed by fully routing traffic to the green environment.
This satisfies the immediate rollback requirement with zero downtime because the blue environment remains fully provisioned and warmed up throughout the test.

Anahtar Kavram

AWS CodeDeploy does not natively support canary or linear traffic shifting for EC2/On-Premises deployments; this capability is only available for Amazon ECS and AWS Lambda. Therefore, achieving a canary deployment pattern with immediate rollback on EC2 requires using Application Load Balancer (ALB) weighted target groups to route traffic between two separate Auto Scaling groups.
Bu soruyu puanla