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?
- 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.Cevap
- BConfigure 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.
- CCreate 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.
- DDeploy 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.
Cevap
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.
Adım Adım Çözüm
Anahtar Kavram
Orchestrating canary deployments on Amazon ECS through AWS CloudFormation using the AWS::CodeDeployBlueGreen transform.