DOP-C02 Configuration Management and IaC Practice Question
A company uses AWS CodeDeploy for application deployments. They want to ensure that if a deployment fails, the system automatically rolls back to the previous version. Which configuration should they set?
⚠ Common exam trap
It's easy for candidates to confuse lifecycle event hooks with rollback mechanisms, or assume a simple boolean property like 'auto-rollback' exists, when in reality the configuration requires a structured 'autoRollbackConfiguration' object with an enabled flag and specific event triggers.
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
✓
Configure the deployment group to enable automatic rollback when a deployment fails.
AWS CodeDeploy provides a built-in automatic rollback feature that can be configured at the deployment group level. When enabled, CodeDeploy automatically reverts the deployment to the last known successful version if the deployment fails or reaches a specified alarm threshold, without requiring custom scripting or external orchestration.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Define a 'Failure' lifecycle event hook that calls a Lambda function to revert the deployment.
Why it's wrong here
In CodeDeploy, lifecycle event hooks are only invoked at defined deployment phases such as BeforeInstall, AfterInstall, and ValidateService; there is no 'Failure' lifecycle event, and a Lambda hook cannot natively reverse a failed deployment. To return to a known-good state, CodeDeploy provides built-in automatic rollback that redeploys the last successful revision with no custom scripting. A custom Lambda-based rollback would require manually tracking revision history and orchestrating traffic shifts, duplicating functionality that is already native and far more reliable.
- ✓
Configure the deployment group to enable automatic rollback when a deployment fails.
Why this is correct
This is correct because CodeDeploy deployment groups support automatic rollback for trigger events such as DEPLOYMENT_FAILURE, DEPLOYMENT_STOP_REQUEST, and ALARM_ACTIVE. When any of these events occurs, CodeDeploy automatically initiates a new deployment of the last known-good revision to the same deployment group, with no custom code required. This native mechanism is the standard and recommended way to recover from a failed deployment while preserving deployment-group settings such as traffic routing and alarm monitoring.
- ✗
Set the 'auto-rollback' property in the CodeDeploy deployment group to 'true'.
Why it's wrong here
CodeDeploy does not have a property literally named 'auto-rollback' on the deployment group. In the AWS CLI, API, and CloudFormation, the correct structure is automaticRollbackConfiguration (or AutoRollbackConfiguration in CloudFormation), which includes an 'Enabled' boolean and an 'Events' list, such as deployment 'failure' or 'alarm active'. Setting a non-existent property would cause a configuration validation failure and prevent the deployment from proceeding, so this option is not merely a stylistic difference but a technical error.
- ✗
Use a CloudFormation stack with a rollback configuration.
Why it's wrong here
CloudFormation stack rollback operates only on infrastructure resource changes declared in the template, not on application deployments orchestrated by CodeDeploy. If a CodeDeploy deployment referenced by a CloudFormation custom resource fails, CloudFormation may mark the stack update as failed, but rolling back the stack will not restore the target application's previously running revision. Application-level rollback must be configured in the CodeDeploy deployment group, which is separate from CloudFormation's provisioned-resource lifecycle.
Go deeper
Related to this question
About these practice questions
This DOP-C02 question is part of Courseiva's 1,298-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-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 DOP-C02 exam.