Courseiva
SDLC Automation →easyMultiple Choice

DOP-C02 SDLC Automation Practice Question

A company deploys an AWS CloudFormation stack that creates an Auto Scaling group and a launch template. The team wants every code change merged to the main branch to automatically update the stack, and they want to be able to roll back to the previous stack state if the update fails. Which combination of services should they use?

⚠ Common exam trap

The trap here is choosing a custom orchestration with Lambda or Step Functions when the native pipeline and CloudFormation deploy action already provide triggering and rollback.

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

✓

AWS CodePipeline with a CodeCommit source and a CloudFormation deploy action configured to create or update the stack.

The requirement is automated deployment on main branch commits plus automatic rollback on failure. CodePipeline with a CodeCommit source and a CloudFormation deploy action provides both: the source action triggers on branch changes, and the deploy action creates or updates the stack with CloudFormation's built-in rollback on failure, requiring minimal custom code.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Amazon EventBridge with a rule that matches CodeCommit events and targets an AWS Step Functions state machine that calls cloudformation update-stack.

    Why it's wrong here

    EventBridge and Step Functions can orchestrate an update, but the engineer must implement rollback and failure handling explicitly. This is more custom logic than the requirement needs, and update-stack alone does not provide the automatic previous-state restoration that the deploy action offers out of the box.

  • ✗

    AWS CodeCommit with a repository trigger that invokes an AWS Lambda function to call cloudformation create-stack.

    Why it's wrong here

    A repository trigger invoking Lambda can start a deployment, but calling create-stack on an existing stack fails because the stack already exists. This approach also lacks native rollback semantics, so a failed update would not automatically restore the previous stack state without custom logic.

  • ✓

    AWS CodePipeline with a CodeCommit source and a CloudFormation deploy action configured to create or update the stack.

    Why this is correct

    CodePipeline can trigger on commits to the main branch through the CodeCommit source action, and the CloudFormation deploy action performs create or update semantics on the stack. CloudFormation automatically rolls back to the previous stack state if the update fails, satisfying both the automation and rollback requirements natively.

  • ✗

    AWS CodeBuild with a buildspec that runs the AWS CLI cloudformation deploy command and ignores failures.

    Why it's wrong here

    CodeBuild alone does not provide source change triggers for the main branch, so commits would not automatically start a deployment. Ignoring failures also suppresses the signal needed to roll back, and the build would report success even when the stack update failed, defeating the rollback requirement.

About these practice questions

One of 1,298 original DOP-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 →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

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.