AWS Certified DevOps Engineer – Professional (DOP-C02) — Question 41

A company is using AWS CodePipeline to automate its release pipeline. AWS CodeDeploy is being used in the pipeline to deploy an application to Amazon Elastic Container Service (Amazon ECS) using the blue/green deployment model. The company wants to implement scripts to test the green version of the application before shifting traffic. These scripts will complete in 5 minutes or less. If errors are discovered during these tests, the application must be rolled back.
Which strategy will meet these requirements?

Answer options

Correct answer: C

Explanation

Option C is correct because it utilizes the AfterAllowTestTraffic lifecycle event to run test scripts and properly handles errors by exiting the Lambda function with an error, which triggers a rollback. Options A and B are not ideal as they do not specifically use the AfterAllowTestTraffic event for testing before routing traffic. Option D is incorrect because it runs tests after traffic has already been allowed, which does not meet the requirement of testing before traffic shifting.