DVA-C02 Deployment Practice Question
A company uses AWS CodePipeline to deploy a critical web application. The pipeline has a source stage (CodeCommit), a build stage (CodeBuild), and a deploy stage (CodeDeploy). During a recent deployment, the CodeDeploy stage failed because the target EC2 instances were not in a healthy state. The developer needs to ensure that the pipeline automatically rolls back the deployment to the last successful version if the deployment fails. What should the developer do?
⚠ Common exam trap
Test-takers frequently confuse CodePipeline's built-in rollback capabilities with CodeDeploy's automatic rollback, or incorrectly assume that CloudWatch alarms or manual approvals can directly perform rollbacks without custom logic.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
In the CodeDeploy deployment group, enable automatic rollback when a deployment fails.
CodeDeploy deployment groups have a built-in automatic rollback configuration that can be enabled to revert to the last successful deployment revision when a deployment fails. This feature directly addresses the requirement without requiring additional services or manual steps, as it operates within the CodeDeploy service itself.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
In the CodeDeploy deployment group, enable automatic rollback when a deployment fails.
Why this is correct
AWS CodeDeploy deployment groups offer a built-in feature to automatically roll back a deployment when it fails. This configuration ensures that if any step within the deployment process, such as application installation or health checks, reports a failure, CodeDeploy will automatically revert the instances in the deployment group to the last successfully deployed application revision. This mechanism is specifically designed to maintain application availability and quickly recover from faulty deployments without manual intervention.
- ✗
Use AWS CloudFormation to manage the deployment and enable rollback on failure.
Why it's wrong here
AWS CloudFormation is primarily an infrastructure as code service used for provisioning and managing AWS resources, not for deploying application code directly onto instances or serverless functions. While CloudFormation does support rollback, this functionality is specifically tied to failures during stack creation, update, or deletion operations, reverting the infrastructure state. It does not manage or automatically roll back failures that occur within an application deployment orchestrated by CodeDeploy.
- ✗
Configure a CloudWatch alarm to trigger a rollback in CodePipeline.
Why it's wrong here
While AWS CloudWatch alarms can monitor application metrics and trigger various actions, including invoking AWS Lambda functions that could potentially initiate a CodePipeline rollback, this approach is an indirect and more complex solution for handling deployment failures. CodePipeline itself does not have a native "rollback" action directly triggered by a CloudWatch alarm for a failed CodeDeploy stage. Furthermore, this method would react to post-deployment issues rather than automatically reverting *during* a CodeDeploy failure.
- ✗
Modify the CodePipeline stage to include a manual approval step that checks health before proceeding.
Why it's wrong here
Including a manual approval step in a CodePipeline stage serves as a gate for human intervention, allowing a team member to review the deployment's status or health checks before allowing the pipeline to proceed to subsequent stages. However, a manual approval step does not provide an automatic rollback mechanism. If a deployment has already failed in a previous stage, or if a human approves a faulty deployment, this step will not automatically revert the application to a prior working state.
Go deeper
Related to this question
About these practice questions
One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.