An enterprise architecture team is designing a deployment workflow for a critical customer-facing microservice running on Amazon ECS with the AWS Fargate launch type behind an Application Load Balancer. The update process must be managed using AWS CloudFormation. The team requires a traffic shifting model that shifts of production traffic to the new version initially, and then progressively increases the traffic by every minutes until the new version handles of the traffic. If any CloudWatch alarms are triggered during the deployment or during a subsequent -minute monitoring window, the deployment must automatically roll back.
Which configuration represents the most operationally efficient method to achieve these requirements?
- ADefine the ECS service deployment controller type as `ECS` in the CloudFormation template. Create an AWS CodeDeploy deployment group that uses the `CodeDeployDefault.ECSCanary10Percent5Minutes` configuration. Configure the Application Load Balancer with a single target group, and configure CodeDeploy to register new tasks directly into this target group. Associate the CloudWatch alarms with the deployment group, and set the rollback wait time to minutes.
- BConfigure the CloudFormation template to update the ECS service using the default rolling update deployment controller. Set the service's minimum healthy percent to and maximum percent to . Configure a Route 53 weighted record set pointing to two different Application Load Balancer DNS names representing the old and new task versions. Use a custom AWS Lambda function triggered by a CloudWatch event rule to shift Route 53 weights by every minutes, and revert the weights to on the old version if the alarms are triggered.
- Define the ECS service deployment controller type as `CodeDeploy` in the CloudFormation template. Use the `AWS::CodeDeploy::BlueGreen` hook to manage the deployment. Create a custom CodeDeploy deployment configuration specifying a time-based linear traffic routing of every minutes. Configure the CodeDeploy deployment group with two target groups, associate the target CloudWatch alarms, and set the original task set termination wait time to minutes with automatic rollback enabled.Answer
- DUpdate the ECS service deployment controller type to `External` in the CloudFormation template. Use an AWS Lambda-backed custom resource in CloudFormation to invoke a custom AWS Step Functions state machine that updates the Application Load Balancer target group weights by every minutes. Include a step in the state machine to monitor the CloudWatch alarms for minutes after traffic is reached, and trigger a target group weight rollback if any alarm is activated.
Answer
The configuration that sets the ECS service deployment controller to CodeDeploy, utilizes the CloudFormation BlueGreen hook, defines a custom linear deployment configuration of 10% every 5 minutes, and sets the original task set termination wait time to 15 minutes is correct.
The correct option natively integrates AWS CloudFormation, Amazon ECS, and AWS CodeDeploy. By declaring the ECS service deployment controller as `CodeDeploy` and using the `AWS::CodeDeploy::BlueGreen` transform hook, CloudFormation delegates the update process to CodeDeploy. CodeDeploy handles traffic shifting using two target groups, applying the custom time-based linear configuration ( every minutes). The -minute baking period is configured using the original task set's termination wait time; if any associated CloudWatch alarms trigger during this interval, CodeDeploy automatically rolls back the traffic to the original task set without downtime.
Step-by-Step Solution
Key Concept
AWS CloudFormation blue/green deployments for Amazon ECS using AWS CodeDeploy target groups and lifecycle/termination wait times.