A startup is rapidly expanding its application on AWS and frequently deploys new features to its production environment. They use AWS CloudFormation for infrastructure as code. To minimize downtime and ensure a smooth transition between application versions, they want to implement a deployment strategy that gradually shifts traffic from the old version to the new one, with an easy rollback mechanism if issues arise. Which CloudFormation resource type, when integrated with CodeDeploy, best supports this requirement?
- AAWS::CodeDeploy::Application
- BAWS::Serverless::Function
- CAWS::CodeDeploy::DeploymentGroup
- DAWS::CloudFormation::Stack
Show answer & explanationAnswer & explanation
Correct answer: C. AWS::CodeDeploy::DeploymentGroup
The AWS::CodeDeploy::DeploymentGroup resource type in CloudFormation is crucial for defining how an application is deployed, including specifying blue/green deployment strategies. This directly enables gradual traffic shifting and automated rollbacks, meeting the startup's requirements for minimizing downtime and safe deployments.
Why the other options are wrong
- A. AWS::CodeDeploy::Application defines the application itself, but not the deployment strategy.
- B. AWS::Serverless::Function is for defining Lambda functions, not general deployment strategies for applications.
- D. AWS::CloudFormation::Stack is the base unit of CloudFormation, but doesn't directly define deployment strategies.
CodeDeploy Deployment Group
An AWS CodeDeploy Deployment Group specifies the set of individual Amazon EC2 instances, AWS Lambda functions, or Amazon ECS services to which an application revision is deployed. It also defines the deployment configuration and strategies, such as blue/green or in-place deployments.
- Defines target instances/services for deployment.
- Specifies deployment type (in-place, blue/green).
- Includes rollback settings and load balancer integration.
- Integral to automated, safe application delivery.
Memory trick: DeploymentGroup is the traffic controller for your CodeDeploy rollout.