AWS Certified DevOps Engineer – ProfessionalConfiguration Management and Infrastructure as CodeHard
A startup is rapidly expanding its application on AWS and frequently deploys new features that require updates to existing Amazon EC2 Auto Scaling groups. They need a deployment strategy that minimizes downtime and allows for quick rollback in case of issues. The current deployment process uses AWS CloudFormation to manage the Auto Scaling group. They are considering a blue/green deployment strategy. Which CloudFormation resource type, when combined with AWS CodeDeploy, would best facilitate this strategy for their EC2 Auto Scaling groups?
- AAWS::AutoScaling::AutoScalingGroup with a custom CodeDeploy hook.
- BAWS::CloudFormation::Stack with nested stacks for blue and green environments.
- CAWS::CodeDeploy::DeploymentGroup referencing the Auto Scaling group.
- DAWS::EC2::Instance with a user data script for blue/green logic.
Show answer & explanationAnswer & explanation
Correct answer: C. AWS::CodeDeploy::DeploymentGroup referencing the Auto Scaling group.
AWS CodeDeploy natively supports blue/green deployments for Auto Scaling groups. The AWS::CodeDeploy::DeploymentGroup resource type in CloudFormation is used to define the deployment configuration, including the Auto Scaling group to target and the blue/green strategy, allowing CodeDeploy to manage the traffic shifting and instance replacement.
Why the other options are wrong
- A. While AutoScalingGroup is correct, a custom CodeDeploy hook is not the primary mechanism for configuring a native blue/green deployment with CodeDeploy; the DeploymentGroup handles this directly.
- B. While nested stacks can organize infrastructure, they don't inherently provide the blue/green deployment logic for an Auto Scaling group; CodeDeploy is needed for that specific functionality.
- D. Using AWS::EC2::Instance with user data for blue/green logic would be a complex, custom solution that bypasses the native blue/green capabilities of CodeDeploy and would be difficult to manage and scale.
CodeDeploy Blue/Green for ASG
AWS CodeDeploy provides native support for blue/green deployments with Amazon EC2 Auto Scaling groups, enabling zero-downtime updates and easy rollbacks by managing traffic shifting and instance replacement.
- Uses two sets of identical environments (blue/green).
- Traffic is shifted from old (blue) to new (green) environment.
- Minimizes downtime and provides quick rollback.
- Integrated with Auto Scaling Groups and Elastic Load Balancing.
Memory trick: CodeDeploy's DeploymentGroup is the traffic cop, directing users to the new green light.