Question

Difficulty: HardDeployment Strategy Design

An enterprise is designing a deployment pipeline for a critical containerized microservice running on Amazon ECS with AWS Fargate behind an Application Load Balancer (ALB). The infrastructure and deployment pipelines must be managed as infrastructure as code (IaC) using AWS CloudFormation. The enterprise has established the following requirements for deployment strategy design:
- Deployments must be fully automated and must not cause any application downtime.
- A new version of the microservice must be tested with a subset of live traffic, routing exactly 10%10\% of the production traffic to the new version for a duration of 1515 minutes before shifting the remaining 90%90\% of traffic.
- The deployment must automatically roll back immediately if the new version displays any degradation in performance, specifically measured by an increase in 5xx5\text{xx} response codes.

Which two configuration steps should the solutions architect combine to meet these requirements?

  1. Configure the AWS CloudFormation template to use the `AWS::CodeDeploy::BlueGreen` transform, defining an Amazon ECS service that references an AWS CodeDeploy deployment group configured with the `CodeDeployDefault.ECSCanary10Percent15Minutes` deployment configuration.Answer
  2. Create an Amazon CloudWatch alarm to monitor the `HTTPCode_Target_5XX_Count` metric of the replacement target group on the Application Load Balancer, and configure the CodeDeploy deployment group to perform an automatic rollback when this alarm enters the `ALARM` state.Answer
  3. C
    Enable the Amazon ECS deployment circuit breaker on the service definition in the CloudFormation template, and configure the `rollback` parameter to true to automatically roll back the service if container health checks or 5xx5\text{xx} error counts exceed the threshold.
  4. D
    Configure an `UpdatePolicy` with `AutoScalingRollingUpdate` on the Amazon ECS service resource in the CloudFormation template to shift traffic progressively in increments of 10%10\% every 1.51.5 minutes.
  5. E
    Create two Route 5353 weighted alias records pointing to separate blue and green Application Load Balancers, and implement an AWS Lambda function triggered by a cron schedule to increment the weight of the green record by 10%10\% every 1.51.5 minutes.

Answer

Configure the AWS CloudFormation template to use the `AWS::CodeDeploy::BlueGreen` transform with the `CodeDeployDefault.ECSCanary10Percent15Minutes` configuration, and create an Amazon CloudWatch alarm on the `HTTPCode_Target_5XX_Count` metric of the replacement target group to trigger automatic rollback in CodeDeploy.
Implementing a blue/green deployment for Amazon ECS with AWS CloudFormation requires using the `AWS::CodeDeploy::BlueGreen` hook. This integrates CloudFormation with AWS CodeDeploy, allowing the use of predefined deployment configurations like `CodeDeployDefault.ECSCanary10Percent15Minutes` to route 10%10\% of the traffic to the replacement task set for 1515 minutes before shifting the remaining 90%90\%. To automate rollbacks based on application-level issues, a CloudWatch alarm must be created to track 5xx5\text{xx} errors on the replacement (green) target group. Linking this alarm to the CodeDeploy deployment group's automatic rollback configuration ensures that CodeDeploy will immediately revert the traffic shift if the new version exhibits failure rates during the test phase.

Step-by-Step Solution

1
Define the blue/green deployment mechanism for the ECS Fargate service in CloudFormation.
Use the `AWS::CodeDeploy::BlueGreen` transform to delegate deployment management to AWS CodeDeploy.
CloudFormation alone does not natively support canary deployments for ECS; it requires integration with CodeDeploy to orchestrate traffic shifting.
2
Select the appropriate traffic routing configuration.
Specify the `CodeDeployDefault.ECSCanary10Percent15Minutes` deployment configuration in the CodeDeploy deployment group.
This configuration shifts 10%10\% of traffic to the green task set for 1515 minutes, then shifts the remaining 90%90\% if no errors are detected, meeting the traffic routing requirement.
3
Configure the rollback trigger based on error rates.
Create a CloudWatch alarm monitoring `HTTPCode_Target_5XX_Count` on the replacement target group and configure the CodeDeploy deployment group to roll back when the alarm is in `ALARM` state.
This ensures that if the new version generates 5xx5\text{xx} errors during the 1515-minute test period, CodeDeploy will automatically roll back to the old version immediately.

Key Concept

Integration of AWS CloudFormation with AWS CodeDeploy for automated, alarm-backed container canary deployments.
Estimated Time:3m 0s
Rate this question