Courseiva
Configuration Management and IaCmediumMultiple ChoiceObjective-mapped

DOP-C02 Configuration Management and IaC Practice Question

A DevOps team uses AWS CodePipeline to automate deployments. The pipeline has a Deploy stage that uses AWS CloudFormation to create or update a stack. Recently, a stack update failed because the template referenced an AMI that was deprecated. The team wants to automatically roll back the stack to the last known good state if a deployment fails. What should they do?

⚠ Common exam trap

Test-takers frequently confuse the CloudFormation stack-level 'DisableRollback' parameter (which controls rollback during stack creation) with the CodePipeline action-level 'Rollback on failure' option, leading them to incorrectly select Option C.

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 CloudFormation deployment action in CodePipeline with 'ActionMode' set to 'CREATE_UPDATE' and check the 'Rollback on failure' option.

The CloudFormation deployment action in CodePipeline supports a 'Rollback on failure' option when 'ActionMode' is set to 'CREATE_UPDATE'. When enabled, if the stack update fails, CloudFormation automatically rolls back the stack to the last known good state (the previously deployed stack). This directly addresses the team's requirement to revert to a stable state after a failed deployment due to a deprecated AMI.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Configure the CloudFormation deployment action in CodePipeline with 'ActionMode' set to 'CREATE_UPDATE' and check the 'Rollback on failure' option.

    Why this is correct

    In CodePipeline, the CloudFormation deployment action requires an explicit ActionMode such as CREATE_UPDATE to create a new stack or update an existing one. When 'Rollback on failure' is selected, CloudFormation automatically rolls back the stack to its last known good state if the deployment fails, restoring both resources and stack outputs. This is the correct mechanism because it leverages CloudFormation's native rollback capability within the pipeline execution, preserving the integrity of the deployed infrastructure.

  • Use the CodePipeline console to enable 'Automatic rollback' for the Deploy stage.

    Why it's wrong here

    The CodePipeline console does not expose an 'Automatic rollback' toggle for a Deploy stage; pipeline stages only support manual or automatic transitions, which either pause execution or allow it to proceed, not rollback of prior actions. A failed pipeline action stops the execution and marks the stage as failed, but CodePipeline itself does not revert deployed resources—it simply halts. The only way to achieve rollback is to configure the underlying deployment action, such as the CloudFormation action, to trigger a rollback on failure.

  • Set the stack's 'DisableRollback' parameter to 'true' in the template.

    Why it's wrong here

    Setting the CloudFormation stack's 'DisableRollback' parameter to 'true' explicitly instructs CloudFormation to leave the stack in a failed state (e.g., CREATE_FAILED or UPDATE_ROLLBACK_FAILED) instead of performing a rollback. This is the opposite of the desired behavior: it prevents automatic recovery from a failed update and can leave the stack partially updated or unusable. Rollback on failure requires the opposite setting—'DisableRollback' must be false or the parameter omitted—so this option is categorically wrong.

  • Add a stack policy to the CloudFormation stack that denies updates to the AMI parameter.

    Why it's wrong here

    A CloudFormation stack policy is a JSON document that defines which resources or Update actions are allowed or denied during stack updates. While it can protect the AMI parameter from being changed unintentionally, it does not initiate or influence rollback behavior when a deployment fails. The policy purely acts as an access control mechanism, not a failure-handling mechanism, so it would neither trigger a rollback nor restore the stack to a prior healthy state; it only prevents certain updates from being applied.

About these practice questions

Courseiva writes every DOP-C02 question from scratch — 251 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.