Courseiva
Development with AWS ServiceshardMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is using AWS CodePipeline to deploy a serverless application. The pipeline has a source stage (CodeCommit), a build stage (CodeBuild), and a deploy stage (CloudFormation). The developer wants to automatically roll back the deployment if the CloudFormation stack update fails. Which configuration should be used?

⚠ Common exam trap

Watch out — candidates often confuse CloudFormation's built-in rollback capability with external services like CodeDeploy, or assume that manual approval is required for rollback, when in fact CloudFormation can handle it automatically via `RollbackConfiguration`.

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 stack to roll back on failure using the RollbackConfiguration.

CloudFormation natively supports automatic rollback on stack update failure through the `RollbackConfiguration` property. When a stack update fails, CloudFormation can automatically revert to the last known good state, which is exactly what the developer needs for a serverless deployment pipeline. This configuration can be set in the CloudFormation template or passed as a parameter during the deploy action in CodePipeline.

Answer analysis

Option-by-option breakdown

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

  • Add a stack policy to the CloudFormation stack to prevent updates.

    Why it's wrong here

    Adding a stack policy to a CloudFormation stack is a security and governance mechanism designed to restrict specific updates or deletions of resources within the stack. It does not provide any functionality for automatically rolling back a failed deployment; instead, it prevents certain changes from occurring. This approach would hinder, rather than enable, a robust deployment and rollback strategy for serverless applications.

  • Set the deployment to use AWS CodeDeploy and enable rollback.

    Why it's wrong here

    AWS CodeDeploy is a deployment service primarily used for automating application deployments to EC2 instances, Lambda functions, or ECS services, offering features like in-place or blue/green deployments with integrated rollback capabilities. However, CodeDeploy is not the native service for deploying or managing the lifecycle of CloudFormation stacks themselves. CloudFormation handles its own stack updates and rollbacks directly, making CodeDeploy an inappropriate choice for this specific task.

  • Configure a manual approval action in the pipeline to trigger a rollback.

    Why it's wrong here

    A manual approval action in an AWS CodePipeline workflow pauses the pipeline's execution, requiring a human to explicitly approve or reject the continuation of the deployment. While a human could, upon approval failure, manually trigger a rollback by deploying a previous version, the approval action itself does not automatically initiate a rollback on deployment failure. It serves as a gate for human review, not an automated failure response mechanism.

  • Configure the CloudFormation stack to roll back on failure using the RollbackConfiguration.

    Why this is correct

    Configuring the CloudFormation stack with a `RollbackConfiguration` is the correct and most effective method for automatically rolling back a failed stack update. This feature allows you to specify CloudWatch alarms that CloudFormation monitors during and after a stack update. If any specified alarm enters an `ALARM` state within a defined monitoring period, CloudFormation will automatically initiate a rollback to the stack's previous stable state, ensuring service stability.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This DVA-C02 question is part of Courseiva's 724-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 →

How Courseiva writes practice questions · Editorial policy

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.