DOP-C02 Question 8
Single answerYou are managing a CI/CD pipeline for an application hosted on AWS. The pipeline uses AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy. The application is deployed to an Auto Scaling group of Amazon EC2 instances running in two Availability Zones. A new requirement mandates that the pipeline should automatically roll back to the previous application version if a deployment fails. How can you implement this rollback functionality?
- A
Enable automatic rollback in the CodeDeploy deployment group configuration and specify failure conditions.
- B
Add a manual approval action in the CodePipeline workflow to approve or reject rollbacks.
- C
Configure the CodeBuild project to monitor deployment failures and trigger a rollback script.
- D
Use an Amazon CloudWatch alarm to detect deployment failures and trigger a Lambda function that initiates a rollback.
Show answer and explanation
Correct answer: A
Explanation
To implement automatic rollback for deployments in AWS CodeDeploy, you can enable the rollback feature in the deployment group configuration. This allows CodeDeploy to automatically roll back to the last known good application revision if a deployment fails. It is a built-in, managed feature that simplifies handling deployment failures, ensuring consistency and reliability.
- A. Correct.
This is correct. AWS CodeDeploy provides a built-in feature to enable automatic rollback. You can configure the deployment group to roll back when specific failure conditions occur, such as failed deployments or alarm triggers.
- B. Incorrect.
This is incorrect. A manual approval action in CodePipeline does not automate the rollback process. It requires human intervention and does not fulfill the 'automatic rollback' requirement.
- C. Incorrect.
This is incorrect. CodeBuild is primarily used for building and testing code. While you can write custom scripts to handle rollbacks, it is not the recommended or built-in way to manage rollback functionality in AWS.
- D. Incorrect.
This is incorrect. While CloudWatch alarms and Lambda functions can provide custom rollback mechanisms, CodeDeploy already provides a native automatic rollback feature that is more efficient and easier to maintain.