INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: CI/CD design: from checks to release and recovery

AWS deployment rollback: application recovery and database compatibility

Rollback switches to a previous version as a way to recover from a harmful change. Database writes can remain after application rollback. Use two failures of the same ECS application to identify what can be restored, which versions can read the data and how to verify recovery.

What you will learn

Distinguish source history, the deployed version and stored data; explain when to roll back and when a compatible forward fix is needed.

Prerequisite

The preceding fictional system has an ECS/Fargate business application, an ALB routing requests and a database shared by old and new versions. A is old; B is new. No live operations or customer data are used.

First separate the states you intend to restore

Reverting a Git change, switching an application and restoring a database are separate operations. Editing source does not change the running version; running the old application does not rewind database rows. Recovery decisions must account for artifacts, configuration, data and user outcomes.

R1/R2 recovery states: switching versions leaves shared data in place
R1/R2 recovery states: switching versions leaves shared data in place1: Git history — Build and validate — Deployable artifact. 2: Deployable artifact — Deploy the identified output — Running application. 3: Running application — Read and write — Current shared data. 4: Current shared data — Verify correct outcomes — User outcomes1234Git historyDeployable artifactRunning applicationCurrent shared dataUser outcomesR1/R2 recovery states: switching versions leaves shared data in place1: Git history — Build and validate — Deployable artifact. 2: Deployable artifact — Deploy the identified output — Running application. 3: Running application — Read and write — Current shared data. 4: Current shared data — Verify correct outcomes — User outcomes1234Git historyDeployableartifactRunningapplicationCurrent shareddataUser outcomes
  1. Git history → Deployable artifactBuild and validate
  2. Deployable artifact → Running applicationDeploy the identified output
  3. Running application → Current shared dataRead and write
  4. Current shared data → User outcomesVerify correct outcomes
Git history
A commit reverses a source change.
Deployable artifact
Identify the build and configuration.
Running application
Switch between A and B.
Current shared data
Verify compatibility of existing writes.
User outcomes
Check reads, writes and missing records.

R1 and R2: the same old version has different recovery conditions

Fictional order app: can A read what B wrote?
ConditionR1: presentation defect onlyR2: a new stored value
States understood by Anew / donenew / done
States written by BOnly new / doneAdds archived
Supplied test resultA correctly reads every relevant valueA cannot process archived
Recovery candidateSwitch to validated A with compatible configuration, then verify outcomesContain B’s impact; validate a compatible forward fix or explicit data repair
PreserveValid orders created while B ranValid orders and evidence needed to investigate

R1 explicitly supplies verified compatibility between A and current data, making A a recovery candidate. Also verify artifact availability and current configuration, connections and permissions. “It worked before” alone does not establish recovery now.

In R2, archived remains in the database after traffic returns to A, so A’s reads do not recover. Contain the affected writes or feature, then evaluate a reader-compatible forward fix or an explicit data repair that preserves meaning. Do not change records before defining the method, authority and validation.

Prepare readers before introducing new stored values

During coexistence, test whether the required readers can process data from both writers. Preparing readers before introducing a new format can preserve more recovery options.

An alternative to R2: prepare readers first
StageFictional application changeCondition to advance
Preparation CReads new/done/archived but still writes only new/doneEvery required reader and retained recovery target supports the values
Enablement DStarts writing archivedReads and updates work during coexistence and after recovery
Later cleanupDecide when to remove obsolete behaviorOld readers, queued work and recovery targets no longer need it

Distinguish rollback, a forward fix and database restore

Define the unsuccessful-change plan before deployment, distinguishing known-good recovery from a forward fix under specified conditions. Identify authority, scope, execution conditions and recovery checks.

Decision inputs for R1/R2
OptionWhat changesWhat it does not establish by itself
Switch application to ARunning application and selected configurationWhether A reads current data or users have recovered
Compatible forward fixValidate and deploy code that handles current valuesThe safety of an untested emergency edit
Database restoreCreate data at a recovery point in a restore destinationPreservation of later valid writes, business cutover and reconciliation
Git revertAdd a commit reversing a source changeAutomatic changes to a destination or its database

A reverted deployment still needs recovery verification

  1. Contain the deployment or affected writes within the agreed scope.
  2. Record the revision, artifact, configuration, data changes and affected user operations.
  3. Test current-data compatibility as in R1/R2; confirm recovery method and authority.
  4. Verify artifact availability and compatible configuration, then execute the agreed method.
  5. Match the observed revision and destination; validate reads, writes, preserved orders and retries.
  6. Record when impact ended and the recovery evidence; carry forward unresolved repairs and unknowns.

The ECS deployment circuit breaker can detect failures of applicable rolling deployments and roll back to an eligible COMPLETED deployment. It does not remove archived values from the database. If an old revision is already terminated or removed, an immediate traffic switch may not be available. Check retention and recovery rules for the strategy.

Check which state can safely be restored

Choose an option to see the result and explanation.

R1 verifies A can read current data. What about valid orders created while B ran?
Read the answer and reason

Answer: Preserve them and verify correct reads and processing with A. · Recovery must preserve legitimate current business state.

In R2, B writes archived and A cannot read it. Does routing back to A complete recovery?
Read the answer and reason

Answer: No; select a compatible recovery method and verify the outcome. · Because archived remains, switching only to A does not fix R2 reads.

D starts writing archived. What must recovery target C support?
Read the answer and reason

Answer: Validate reads of current values and the required updates. · Choose a version compatible with current state, not original A unconditionally.

A git revert commit exists. What has that completed?
Read the answer and reason

Answer: A source reversal; deployment and data recovery remain separate. · Verify the actual destination and user outcomes separately.

Check, then explain in your own words

  1. Distinguish source history, the running application and shared data.
  2. Compare reads after switching to A in R1 and R2.
  3. Explain C/D ordering and recovery targets compatible with current values.
  4. Carry user impact and recovery evidence into the post-incident lesson.
Check your understanding: R2 switches to a compatible fix C and gets HTTP 200. Is recovery complete?

Not yet. Match the observed version and destination; verify reads including archived, required updates, preserved valid orders and affected user operations.

Successful deployment and recovery of the affected business behavior require separate checks.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.