An organization is deploying a new version of a microservice hosted on Amazon ECS Fargate using AWS CloudFormation. The deployment strategy must shift 10% of the traffic to the new version initially, and monitor the application for 15 minutes. If any CloudWatch alarms are triggered during this period, the deployment must automatically roll back. Otherwise, the remaining 90% of the traffic must be shifted to the new version. Which of the following configurations should the Solutions Architect implement in the CloudFormation template to meet these requirements?
- Configure the ECS service deployment controller to CODE_DEPLOY, and configure the AWS::CodeDeploy::BlueGreen hook in the CloudFormation template with the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and target CloudWatch alarms.Answer
- BConfigure the ECS service deployment controller to ECS (rolling update), set the minimumHealthyPercent parameter to 90%, and specify CloudFormation RollbackTriggers to monitor the CloudWatch alarms.
- CConfigure the ECS service deployment controller to CODE_DEPLOY, and configure the AWS::CodeDeploy::BlueGreen hook in the CloudFormation template with the CodeDeployDefault.ECSLinear10PercentEvery15Minutes deployment configuration and target CloudWatch alarms.
- DConfigure the ECS service deployment controller to EXTERNAL, and deploy an AWS Lambda function within CloudFormation that updates the Application Load Balancer listener rule weights from 10% to 100% after a 15-minute wait.
Answer
Configure the ECS service deployment controller to CODE_DEPLOY, and configure the AWS::CodeDeploy::BlueGreen hook in the CloudFormation template with the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and target CloudWatch alarms.
The correct configuration uses the CODE_DEPLOY deployment controller for the ECS service along with the AWS::CodeDeploy::BlueGreen hook in CloudFormation. By selecting the CodeDeployDefault.ECSCanary10Percent15Minutes configuration, CodeDeploy shifts 10% of the traffic to the new task set, waits for 15 minutes while monitoring the specified CloudWatch alarms, and automatically rolls back if any alarm is triggered. If no alarms trigger, it routes the remaining 90% of traffic to complete the deployment.
Step-by-Step Solution
Key Concept
AWS CloudFormation integrates with AWS CodeDeploy using the AWS::CodeDeploy::BlueGreen hook to manage canary and linear traffic-shifting deployments for ECS Fargate services, enabling automatic rollback based on CloudWatch alarms.