# Deployment Rollback

Deployment rollback restores a previously validated application, infrastructure, or model release when a new deployment fails or causes unacceptable behavior.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/deployment-rollback

> Rollback limits the impact of a faulty release by returning workloads to a known-good deployment state. It depends on preserved artifacts, compatible dependencies and data, reliable failure signals, and a tested recovery procedure rather than simply undoing a source-code change.

Practice exams covering Deployment Rollback: [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [AIP-C01 AWS Certified Generative AI Developer - Professional](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Deployment Rollback

Reliable rollback combines reproducible releases, meaningful health signals, compatible state, controlled traffic changes, and verified recovery.

1. **Known-good, reproducible releases**: Retain immutable artifacts and the configuration needed to reproduce a validated deployment. Pin dependencies and model components instead of rebuilding an old release from mutable references during an incident.
2. **Impact-based failure detection**: Combine deployment events with application metrics, synthetic transactions, and functional validation. Set alarm thresholds and observation windows that detect meaningful regressions without triggering rollback on brief, harmless fluctuations.
3. **Controlled traffic restoration**: Canary and blue/green deployments can preserve the previous version while validating a replacement. Confirm that the old environment has sufficient capacity and remains compatible with current dependencies before directing traffic back.
4. **State and dependency compatibility**: Application rollback does not automatically reverse database changes or external side effects. Use backward-compatible interfaces and schema migrations, and define separate recovery or compensation procedures for irreversible actions.
5. **Model-aware release management**: Version customized weights, adapters, base models, tokenizers, serving images, and associated configuration together. Validate model quality and safety as well as availability, because a healthy endpoint can still serve a regressed model.
6. **Tested recovery and evidence preservation**: Exercise rollback procedures, permissions, and recovery timing before production incidents. Preserve logs and deployment metadata, verify recovery after execution, and keep an alternative plan when rollback itself fails.

## Cloud services for Deployment Rollback

CodePipeline coordinates build, validation, and deployment actions, with CodeBuild producing artifacts and test evidence. CodeDeploy handles application deployment recovery, while CloudFormation manages infrastructure changes and their stack-level rollback behavior. CloudWatch metrics, logs, alarms, and Synthetics canaries help identify regressions and provide signals to supported rollback mechanisms. For customized models, SageMaker AI combines versioned model packages with endpoint deployment controls, while pipelines enforce evaluations and approval requirements. These services must share consistent release identifiers and retain previous artifacts; none can automatically reverse every database change, external side effect, or model-quality regression without an explicitly designed recovery workflow.

- **[AWS CodeDeploy](https://blowstack.com/tools/cloud-services-hub/aws-codedeploy)**: CodeDeploy supports automatic rollback when configured deployment failures or CloudWatch alarm conditions occur. Rollback redeploys a previously deployed revision rather than reversing every side effect of the failed release.
- **[Amazon SageMaker](https://blowstack.com/tools/cloud-services-hub/amazon-sagemaker)**: SageMaker Model Registry supports versioning and approval workflows for model packages, while endpoint deployment mechanisms deploy the selected versions. For supported endpoint configurations, deployment guardrails can monitor CloudWatch alarms and automatically roll back an unhealthy update; model-quality regressions require appropriate evaluation and monitoring.
- **[AWS CloudFormation](https://blowstack.com/tools/cloud-services-hub/aws-cloudformation)**: CloudFormation can roll back failed stack operations, subject to operation settings and resource behavior. Inspect stack events when recovery fails, and do not treat stack rollback as a backup or restoration mechanism for application data.
- **[Amazon CloudWatch](https://blowstack.com/tools/cloud-services-hub/amazon-cloudwatch)**: CloudWatch provides metrics, logs, alarms, and Synthetics canaries for detecting deployment regressions. Its alarms supply failure signals to supported deployment controllers; an alarm alone does not universally execute a rollback.
- **[AWS CodePipeline](https://blowstack.com/tools/cloud-services-hub/aws-codepipeline)**: CodePipeline coordinates release actions and exposes execution history for tracing failed deployments. Configured stage rollback or explicit recovery actions can restore earlier deployment inputs, but stopping a pipeline does not by itself undo changes already made.
- **[AWS CodeBuild](https://blowstack.com/tools/cloud-services-hub/aws-codebuild)**: CodeBuild runs builds and tests whose logs help distinguish artifact-generation failures from deployed application failures. It can execute scripted recovery steps when explicitly configured, but it is not inherently a production rollback controller.

## Deployment Rollback exam questions

Real practice exam questions on Deployment Rollback, with the correct answer and its explanation.

### Question 1 (DVA-C02)

**Question:**

A company uses AWS CodeDeploy in-place deployments to release an application to Amazon EC2 instances behind an Application Load Balancer. The deployment group is already configured to automatically roll back failed deployments. The AppSpec file's ValidateService script currently checks only whether the application process is running.

A recent release started successfully and returned HTTP 200 from its static /health endpoint, but an incorrect application configuration prevented it from reading required data from a downstream service. CodeDeploy marked the deployment successful. The previous revision can still access the downstream service correctly.

The developer must make CodeDeploy detect this type of failure during future deployments and trigger the existing rollback behavior without adding an external monitoring system. Which change should the developer make?

**Correct answer:** Update the ValidateService script to execute a representative application request that reads from the downstream service, verify the response, and exit with a nonzero status if validation fails.

**Explanation:** ValidateService runs after the new application has started. A functional check tests behavior that a process check or static endpoint cannot verify. Returning a nonzero exit status fails the lifecycle event and deployment, allowing the configured automatic rollback to restore the previous revision.

### Question 2 (SAP-C03)

**Question:**

A company runs an API on 20 Amazon EC2 instances in an Auto Scaling group behind an Application Load Balancer. The group uses launch template version 41, which references an explicit AMI ID. Desired capacity remains at 20 during releases, and sufficient capacity exists to run up to 22 instances. Application versions are compatible with each other and with the database.

The release pipeline creates launch template version 42 with a new AMI. The company requires deployments to replace instances gradually, maintain at least 20 healthy instances, and run no more than 22 instances at any time. Some releases pass instance and load balancer health checks but cause business transaction failures. An existing Amazon CloudWatch alarm reliably detects these failures. The alarm can enter ALARM during deployment or within 15 minutes after the final instance replacement.

If the alarm enters ALARM during either period, the deployment must automatically restore the previous launch template configuration and replace instances that use the faulty release. No operator intervention or custom rollback orchestration is permitted.

Which deployment configuration meets these requirements?

**Correct answer:** Start an Auto Scaling instance refresh with desired configuration set to launch template version 42. Set minimum healthy percentage to 100 and maximum healthy percentage to 110. Configure the CloudWatch alarm, enable automatic rollback, and specify a 15-minute bake time.

**Explanation:** An instance refresh progressively replaces the fleet. With desired capacity 20, these healthy-percentage settings preserve 20 healthy instances while allowing up to 22 instances. Specifying version 42 as the desired configuration gives Auto Scaling the configuration transition needed for automatic rollback. The configured alarm can trigger rollback during replacement and during the final 15-minute bake time, while the refresh remains in progress.

### Question 3 (AIP-C01)

**Question:**

A financial services company uses an Amazon Bedrock fine-tuned model to classify regulatory correspondence. Production requests invoke a Provisioned Throughput resource associated with the approved model. A newly fine-tuned version has passed offline evaluations. For the selected model and AWS Region, customized-model inference requires Provisioned Throughput.

The company must send 5% of production requests to the new version while the remaining requests continue to use the approved version. If classification quality deteriorates, all traffic must return to the approved version within seconds, without waiting for model provisioning or a model update operation. All inference must remain in Amazon Bedrock. The company has sufficient quota and budget for temporary additional capacity.

Which deployment approach meets these requirements?

**Correct answer:** Create a separate Provisioned Throughput resource for the new custom model and wait until it is ready. Use application-controlled routing to send 5% of requests to its ARN and 95% to the existing resource's ARN. Retain the existing resource throughout the rollback window and restore its routing share to 100% if quality deteriorates.

**Explanation:** Separate, ready Provisioned Throughput resources keep both model versions available concurrently. Application-controlled routing provides the canary split and can immediately direct all subsequent requests back to the approved version without provisioning capacity or updating either model association. The old resource can be retired after the acceptance and rollback window ends.

### Question 4 (DOP-C02)

**Question:**

A company uses AWS CodeDeploy to deploy an AWS Lambda function through a production alias. The deployment uses a canary configuration that routes 10% of traffic to the new function version for 15 minutes before shifting the remaining traffic. Five minutes into the canary interval, application telemetry shows that requests handled by the new version are failing. The previous version remains healthy, and both versions are compatible with the current database schema.

The CodeDeploy deployment is still InProgress. Its validation hooks have succeeded, no CloudWatch alarms are associated with the deployment group, and automatic rollback is disabled. The previous function version and the deployment history are available.

A DevOps engineer must immediately stop the rollout and have CodeDeploy restore the production alias to the previous version without building or publishing another function version. Which action should the engineer take?

**Correct answer:** Call StopDeployment for the active deployment with autoRollbackEnabled set to true.

**Explanation:** StopDeployment can explicitly request rollback when stopping an active deployment. Setting autoRollbackEnabled to true causes CodeDeploy to initiate recovery to the previous known-good deployment, restoring the production alias rather than merely halting additional traffic shifting. This request does not require automatic rollback to have been enabled previously on the deployment group.

## Practice Deployment Rollback in a full exam

Questions on Deployment Rollback in each practice exam, with every answer option and an explanation for each:

- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 7 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 5 questions
- [AIP-C01](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional): 3 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 3 questions

## What is Deployment Rollback

Deployment rollback is a recovery action that replaces a problematic release with a previously validated version or redirects traffic back to that version. The deployment unit can include application binaries, container images, infrastructure configuration, runtime settings, or machine learning model artifacts. The objective is to restore acceptable service quickly while preserving evidence for diagnosis. A rollback is not necessarily a reversal of every change: it usually restores executable code and configuration, while data recovery and external side effects require separate handling.

Effective rollback starts before deployment. Preserve immutable, versioned artifacts and record which configuration, dependencies, secrets references, and infrastructure definitions belong to each release. Define measurable acceptance criteria, such as request error rate, latency, successful synthetic transactions, and business-operation success. Canary or blue/green deployment can expose a new release to limited traffic while retaining the previous environment. Keeping that environment available consumes additional capacity, but often makes recovery faster than rebuilding it during an incident.

When a deployment fails, first identify the failing stage and distinguish a build failure from a production regression. In AWS CodePipeline, inspect the failed action and its downstream deployment status. AWS CodeBuild logs can reveal compilation errors, failed tests, dependency problems, or incorrect artifact packaging; a failed build generally does not require production rollback if nothing was deployed. For AWS CodeDeploy, inspect deployment events, lifecycle-hook failures, target health, and deployment-group settings. For AWS CloudFormation, inspect stack events and resource failure reasons rather than assuming the final stack status explains the root cause. Correlate timestamps with application logs, permission changes, service quotas, and dependency failures.

Rollback triggers should reflect customer impact without reacting excessively to noise. Amazon CloudWatch alarms can detect elevated errors or latency, while CloudWatch Synthetics canaries exercise workflows that basic health checks miss. For example, a release might pass a process-level health check but fail checkout because of an incompatible API response. A configured deployment controller can stop promotion and restore the earlier release when its supported alarm-based rollback conditions are met. After rollback, repeat functional checks and confirm traffic, capacity, and customer-facing metrics have recovered; successful execution of the rollback operation alone is insufficient.

Stateful changes are a major constraint. Reverting an application does not undo database writes, schema migrations, messages already published, or calls to external payment systems. Use backward-compatible schema changes and staged migrations so both old and new application versions can operate during transition. Destructive changes may make rollback unsafe, requiring a forward fix or a separately planned data recovery. Infrastructure rollback also has limits: CloudFormation can attempt to restore a stack after a failed update, but rollback can fail because of permissions, dependencies, or resource state, and it does not guarantee restoration of application data.

For customized foundation models, treat the release as more than a set of weights. Version the base model, fine-tuned weights or LoRA adapters, compatible inference container, tokenizer, prompt configuration, and evaluation results. An adapter must match its intended base model and serving implementation; changing only the adapter can break inference or degrade output quality. SageMaker Model Registry records model versions and approval status, while a deployment pipeline selects and deploys the approved artifacts. Registry approval alone does not deploy or roll back an endpoint. Supported SageMaker AI endpoint deployment guardrails can use CloudWatch alarms to trigger automatic rollback, but semantic quality and safety regressions require suitable evaluations and monitored signals beyond HTTP success. Retain the previous model release through the validation window, and retire obsolete versions only after checking rollback requirements, dependencies, and retention obligations.

## Learn Deployment Rollback in lessons

3 short lessons on Deployment Rollback in 3 certification courses.

- SAP-C03: Deployment Rollback: safe restoration of a known-good release (Premium), https://app.blowstack.com/lessons/deployment-rollback-safe-restoration-of-a-known-good-release-sap-c03
- AIP-C01: Deployment Rollback: restoring known-good model releases (Premium), https://app.blowstack.com/lessons/deployment-rollback-restoring-known-good-model-releases-aip-c01
- DOP-C02: Deployment Rollback: safe restoration of a known-good release (Premium), https://app.blowstack.com/lessons/deployment-rollback-safe-restoration-of-a-known-good-release-dop-c02
