Question

Difficulty: HardDeployment Strategy Design

A company is designing a deployment pipeline for a web application running on Amazon EC2 instances managed by an Auto Scaling group behind an Application Load Balancer (ALB). The infrastructure is managed using AWS CloudFormation. A solutions architect must design a deployment strategy that meets the following requirements:
- Production traffic must be shifted gradually to the new version: 10% of the traffic must be routed to the new version for a 15-minute evaluation period, followed by 100% of the traffic if no errors are detected.
- If any application errors or high latency are detected during the deployment or the evaluation period, traffic must be rolled back immediately with zero downtime and without waiting to launch or provision new instances.
- The entire deployment and rollback process must be fully automated and defined as infrastructure as code.

Which two actions should the solutions architect combine to meet these requirements? (Select two.)

  1. Configure the Application Load Balancer listener rule with two target groups (blue and green) and use AWS CloudFormation to shift traffic weights from 90:10 to 0:100.Answer
  2. Define AWS CloudFormation rollback triggers linked to Amazon CloudWatch alarms monitoring application error metrics to automatically revert the stack update if issues occur during the evaluation period.Answer
  3. C
    Configure the Auto Scaling group with an Instance Refresh policy set to a 90% minimum healthy percentage and a 15-minute warm-up period, and configure CloudFormation to roll back on failure.
  4. D
    Use AWS CodeDeploy with a blue/green deployment group and select the predefined CodeDeployDefault.EC2Canary10Percent15Minutes deployment configuration.
  5. E
    Configure Amazon Route 53 with weighted routing records pointing to two separate Auto Scaling groups, set a low TTL, and use Route 53 DNS failover to route traffic back to the primary group upon health check failure.

Answer

The correct strategy combines using an Application Load Balancer with blue and green target groups managed by AWS CloudFormation to shift traffic weights, along with CloudFormation rollback triggers linked to CloudWatch alarms to automate the rollback.
To satisfy the requirements of gradual traffic shifting, zero downtime, and instant rollback for EC2 instances, the architecture must perform routing adjustments at the load balancer layer. By using an Application Load Balancer with weighted target groups, the solutions architect can split traffic at a precise 90:10 ratio. Managing these weights inside a CloudFormation template ensures the deployment is defined as infrastructure as code. Linking CloudFormation rollback triggers to CloudWatch alarms ensures that if any metric degrades during the 15-minute evaluation, CloudFormation will immediately rollback the stack update, resetting the listener rule weight back to 100% for the original target group. This rollback takes effect instantly because the original EC2 instances in the blue target group are kept active during the deployment.

Step-by-Step Solution

1
Configure the Application Load Balancer with two separate target groups: one containing the existing Auto Scaling group instances (blue) and one containing the new Auto Scaling group instances (green).
Both environments are provisioned and registered under the load balancer but isolated into distinct target groups.
This allows for precise control of traffic distribution at the load balancer level, avoiding the limitations of DNS caching.
2
Configure the Application Load Balancer listener rule in AWS CloudFormation to distribute traffic between the two target groups using weights, starting with a 90:10 ratio (90% to blue, 10% to green) and planning to shift to 0:100 after 15 minutes.
A controlled subset of production traffic is directed to the new version for canary testing.
This fulfills the requirement of shifting 10% of traffic for a 15-minute evaluation period using infrastructure as code.
3
Attach AWS CloudFormation rollback triggers linked to Amazon CloudWatch alarms that monitor key application performance metrics (such as HTTP 5XX error rates and target response times) during the deployment.
The stack update is monitored dynamically, and if any alarm breaches its threshold, CloudFormation immediately rolls back the listener rule weights to the previous state.
This guarantees an automated, immediate rollback with zero downtime by routing all traffic back to the still-running blue target group instances, without needing to provision new instances.

Key Concept

Combining Application Load Balancer weighted target groups with CloudFormation rollback triggers enables a fully automated, IaC-defined canary deployment and instant rollback for EC2-based applications.
Rate this question