A failed deployment does not always require a full version rollback. This runbook explains how to choose between reverting application code, switching blue-green environments, reversing a canary, disabling a feature, or recovering a database migration—while protecting data and keeping incident decisions clear.
Overview
A cloud deployment rollback is the controlled process of returning an application to a known safer state after a release causes errors, degraded performance, security concerns, or unexpected behavior. The safest response depends on what changed and whether the change is reversible.
Start by separating the incident into three questions:
- Is the problem in the application version? A code, dependency, configuration, or image rollback may be appropriate.
- Is the problem limited to new functionality? A feature-flag shutdown can reduce impact without replacing the entire release.
- Did the release change data or database structure? Database recovery requires additional compatibility checks and should not be treated as a simple code revert.
Before acting, assign an incident lead, record the current release identifier, preserve relevant logs, and confirm the scope of impact. Use the deployment platform's documented release history rather than relying on memory or an untracked manual command. A preflight process, such as the one in the Cloud Deployment Preflight Checklist for Web Applications, can reduce the number of releases that reach this state.
Choose the least disruptive safe response
| Situation | Preferred first response | Main caution |
|---|---|---|
| New code is failing and the previous build is intact | Version rollback | Confirm the previous build still works with current configuration and data |
| Two production environments are available | Blue-green traffic switch | Check that the standby environment is receiving compatible data and secrets |
| Only a small percentage of traffic has the new release | Canary reversal | Stop promotion and verify that traffic has actually drained |
| A discrete feature is causing harm | Feature-flag shutdown | Ensure the disabled path is tested and does not leave partial state |
| A schema or data migration is involved | Pause, assess compatibility, then follow the migration runbook | Do not blindly restore code against an incompatible schema |
Maintenance cycle
A rollback runbook is only useful if it matches the systems that actually deploy your application. Review it on a regular cycle—every six months is a practical baseline—and after a major change to the cloud app hosting, CI/CD workflow, runtime, database, or observability stack.
During each review, confirm the following:
- Release identification: Every artifact has a traceable commit, build, image, or release ID. The team knows how to locate the last known-good version.
- Deployment behavior: Document what the app deployment platform does when a release is stopped, rejected, or rolled back. Verify whether traffic shifts immediately, gradually, or only after a health check.
- Configuration compatibility: Check environment variables, secrets, service endpoints, runtime versions, and dependency locks. A prior application build may not work with a newly changed setting.
- Health checks and monitoring: Confirm that readiness checks, error-rate alerts, latency measurements, and business-level signals can distinguish a healthy rollback from a merely running process.
- Permissions: Make sure the on-call role can stop a rollout, select a prior artifact, change traffic, disable a feature, and inspect logs without waiting for an unavailable administrator.
- Practice: Run a controlled rollback in a non-production environment. Record how long it takes, which commands or interface steps are required, and where the procedure is ambiguous.
Keep provider-specific commands in the operational version of the runbook, not in a generic article. Commands and deployment-tool behavior change; the decision framework should remain stable while the implementation details are refreshed.
Signals that require updates
Some changes should trigger an immediate runbook review rather than waiting for the scheduled maintenance cycle. Update the procedure when:
- The team changes its cloud-native app platform, hosting provider, deployment controller, or infrastructure-as-code workflow.
- A new rollout method is introduced, such as blue-green deployment, canary delivery, progressive traffic shifting, or automatic promotion.
- The application adopts a new runtime, base image, framework, dependency-management approach, or configuration system.
- Database migrations change from backward-compatible releases to operations that rename, remove, transform, or backfill data.
- Feature flags become part of release control, especially if flags can alter writes, authorization, billing, or external integrations.
- An incident reveals that alerts were late, logs were missing, rollback permissions were insufficient, or the previous release was not deployable.
- Search intent or team terminology changes and developers can no longer find the relevant recovery procedure quickly.
Use incident reviews to improve the runbook, not to assign blame. A useful update records the observed symptom, the chosen recovery path, the evidence used to make the decision, and the verification steps that confirmed service recovery. For related release controls, review the guidance on zero-downtime database migrations and rollback planning.
Common issues
Rolling back code after an incompatible migration
This is one of the most dangerous patterns. If a new release removes a column, changes a data type, or writes records that the old version cannot understand, returning to the old binary may create more errors. Prefer expand-and-contract changes: add compatible structures first, deploy code that can work with both forms, migrate data, and remove the old structure only after the older release is no longer needed.
Assuming a traffic switch stopped every request
Existing connections, queues, caches, background workers, and long-running jobs may continue using the failed version. After a blue-green switch or canary reversal, check active instances, worker pools, scheduled jobs, and message consumers. Drain or stop them according to the platform's documented behavior.
Using a feature flag as a substitute for rollback
A flag is valuable when the feature is isolated and the fallback path is reliable. It is not a complete recovery plan if the release also changed shared schemas, startup behavior, authentication, or a common API contract. Verify both flag states before production and remove temporary flags after the incident.
Restoring service without proving the cause
Recovery comes first, but preserve enough evidence to investigate afterward. Capture deployment metadata, timestamps, representative errors, affected endpoints, database migration status, and relevant configuration differences. Also confirm that security controls, authorization behavior, and API contracts remain correct; operational recovery should not quietly reintroduce a vulnerability or break clients.
Relying on a backup as the first rollback option
Backups are essential for data recovery, but restoring one can discard valid writes made after the backup point. Treat restoration as a deliberate disaster-recovery action with a defined recovery point, validation plan, and communication path. For routine application failures, a version or traffic rollback is often less destructive when it is technically safe.
When to revisit
Revisit this deployment incident runbook every six months, after a major platform or database release, and immediately after any failed deployment that exposes a gap. Also review it before a high-risk launch, a large schema change, a change in application scaling, or a migration to a different managed backend platform.
Use this short action checklist during an incident:
- Declare the incident and assign one person to coordinate decisions.
- Stop promotion of the release and record the exact artifact and deployment time.
- Determine whether the safest control is a feature shutdown, canary reversal, blue-green switch, or version rollback.
- Check database and message-queue compatibility before reverting application code.
- Apply the smallest safe change, then verify errors, latency, health checks, background work, and key user journeys.
- Communicate status and recovery evidence to stakeholders.
- After stabilization, preserve evidence and update the runbook with the actual steps that worked.
A dependable rollback strategy is designed before the failed deployment occurs. Keep release artifacts available, test recovery paths, document database assumptions, and make the procedure easy to find. That preparation turns an uncertain production failure into a controlled response.