Question

Difficulty: HardDeployment Strategy Design

An enterprise manages a microservices application hosted on Amazon ECS with AWS Fargate behind an Application Load Balancer (ALB). The infrastructure is managed using AWS CloudFormation. The team needs to implement a deployment strategy for new service versions that routes 10% of traffic to the new version, monitors the application for 15 minutes using a CloudWatch alarm tracking HTTP 5XX response codes, and automatically rolls back to the previous version with zero downtime if the alarm triggers. If no alarms are triggered, all traffic must transition to the new version. The entire deployment strategy and workflow must be defined as Infrastructure as Code within the CloudFormation template. Which design meets these requirements?

  1. Add the AWS::CodeDeployBlueGreen transform to the CloudFormation template. Configure the template with blue and green target groups, and define an AWS::ECS::Service resource. Specify the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and the CloudWatch alarm as a rollback trigger in the BlueGreenDeployment properties of the template.Answer
  2. B
    Configure the deploymentCircuitBreaker property with rollback enabled on the AWS::ECS::Service resource in the CloudFormation template. Create an ALB listener rule that routes 10% of traffic to a secondary green ECS service, and use a CloudWatch action to update the CloudFormation stack parameters to shift the traffic weight to 100% green after 15 minutes.
  3. C
    Create two target groups (blue and green) under the ALB. Configure the ALB listener rule in the CloudFormation template with weighted routing: 90% to the blue target group and 10% to the green target group. Use an AWS Lambda-backed custom resource in CloudFormation to sleep for 15 minutes, check the status of the CloudWatch alarm, and update the listener rule weights to 100% green if the alarm is clear.
  4. D
    Deploy the application services within an AWS App Mesh configuration. Use an AWS Step Functions state machine triggered by the CI/CD pipeline to update the App Mesh VirtualRouter route weights to shift 10% of traffic to the green VirtualNode, wait for 15 minutes, check the CloudWatch alarm, and update the route weights to 100% green or roll back to the blue VirtualNode.

Answer

Configure the CloudFormation template using the AWS::CodeDeployBlueGreen transform, defining the BlueGreenDeployment properties with the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and linking the CloudWatch alarm to the deployment group.
The correct option utilizes the native AWS::CodeDeployBlueGreen transform in AWS CloudFormation. This transform automates the blue/green deployment process on Amazon ECS by delegating the deployment execution to AWS CodeDeploy. By configuring the BlueGreenDeployment section with the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and linking the CloudWatch alarm, CodeDeploy manages the traffic shift (10% to green, then 90% after 15 minutes) and monitors the alarm. If the alarm triggers, CodeDeploy immediately and safely rolls back the traffic to the blue target group, satisfying all zero-downtime, automation, and Infrastructure as Code requirements.

Step-by-Step Solution

1
Use the AWS::CodeDeployBlueGreen transform at the top of the CloudFormation template.
Enables CloudFormation to perform blue/green and canary deployments for ECS services by generating the necessary CodeDeploy resources under the hood.
Allows native integration between CloudFormation stack updates and CodeDeploy ECS deployments.
2
Define the blue and green target groups, the production and test ALB listeners, and the AWS::ECS::Service resource in the template.
Establishes the traffic routing endpoints and container configuration required for blue/green shifting.
CodeDeploy needs distinct target groups and listeners to manage traffic redirection between the old (blue) and new (green) versions.
3
Specify the CodeDeployDefault.ECSCanary10Percent15Minutes configuration and the CloudWatch rollback alarm in the BlueGreenDeployment properties of the template.
Automates the 10% canary traffic shift and configures CodeDeploy to monitor the alarm for 15 minutes before completing the deployment or triggering an immediate rollback.
Fulfills the business requirement of canary shifting, duration-based monitoring, and automated rollback.

Key Concept

Orchestrating canary deployments on Amazon ECS through AWS CloudFormation using the AWS::CodeDeployBlueGreen transform.
Rate this question