AWS Certified Developer – Associate / Question #924 of 557

Question #924

A developer is using AWS CloudFormation to deploy an application on Amazon ECS and wants to implement a blue/green deployment strategy using AWS CodeDeploy. The goal is to shift traffic gradually from the old version to the new version while monitoring the deployment's health.

How should the developer configure the CloudFormation template to achieve this?

A

Modify the CloudFormation template to include a Transform section and the AWS::CodeDeploy::BlueGreen hook.

B

Deploy the new version in a separate CloudFormation stack. After validation, update the Route 53 weighted records to redirect traffic to the new stack.

C

Update the existing CloudFormation stack directly to replace the ECS task definition with the new application version.

D

Create a nested stack for the blue/green deployment logic and reference it in the parent stack using the AWS::Include transform.

Explanation

Answer A is correct because the AWS CloudFormation Transform section with the AWS::CodeDeploy::BlueGreen hook automates blue/green deployments via CodeDeploy. This hook configures CodeDeploy to create a new environment (green), reroute traffic incrementally, and monitor health, aligning with the requirement.

Option B is incorrect because manually updating Route 53 records bypasses CodeDeploy's automated traffic shifting and health checks. Option C uses a standard stack update, which replaces the task definition directly without blue/green safety. Option D uses nested stacks for code reuse but does not implement CodeDeploy's blue/green logic. Key points: Use AWS::CodeDeploy::BlueGreen hook in CloudFormation to enable CodeDeploy-managed blue/green deployments with traffic shifting and health monitoring.

Answer

The correct answer is: A