Backup, Restore and Disaster Recovery

Why an untested backup is an assumption, RPO and RTO, backup protections, a restore exercise and choosing a disaster recovery strategy.

  • Advanced
  • About 24 minutes
  • Includes an exercise and a knowledge check

The concept A backup is not proof of recovery

The team configured automated backups. The customer asks: Have you tested restoring them? They have not. A backup that has never been restored is an assumption, not a recovery capability.

A recovery timeline for the example objectives: last recoverable point, failure, service restored. RPO at most 15 minutes is the data that may be lost; RTO at most 2 hours is the time the service is down. Four disaster recovery strategies from lowest cost and slowest to fastest and most complex: backup and restore, pilot light, warm standby, multi-site active. The restore exercise in five steps: approved backup, restore isolated, check counts and totals, confirm the app works, measure time and data loss.
A backup is a promise until you restore it.
ProtectionWhy
Automated backups and point-in-time recoveryRestore to any moment within retention, meeting an RPO of minutes
Object versioningRecover deleted or overwritten settlement files
Backup encryption and separate permissionsA compromised application role cannot delete its own backups
Cross-account or cross-region copies, when justifiedSurvive account compromise or a regional disruption
Documented retention and periodic restore testsProve the capability; meet the customer’s retention rules

A platform is more than its database. Recovery must bring every dependent part back to a consistent point, or the restored database disagrees with the files, queues and keys around it:

PartHow it is protectedHow it is recovered consistently
PostgreSQLAutomated backups and point-in-time recovery; copies in a separate account when justifiedRestore to a chosen time T; everything else is brought into line with T
Settlement files in S3Versioning, write-once retention for originals, replication when justifiedFiles received after T are still in S3: re-register them by checksum, which is idempotent
Queue messagesNot backed up; a queue is in-flight work, not a recordRebuild the work from the database: re-enqueue payments that are RECEIVED but not processed, and republish PENDING outbox rows
Payments after TLost from the database, within the RPOFind the gap by comparing with each provider's reports, and ask providers to resend
SecretsSecrets Manager, replicated to the recovery region when justifiedApplications read them at start-up; rotate any that may have been exposed
Encryption keysKMS keys with deletion protection, multi-Region keys when neededA backup encrypted with a key you can no longer use is lost, so recover the keys first
InfrastructureTerraform code and protected stateRecreate the environment from code, then restore data into it

The restore test validates the business, not just a running database: compare record counts and control totals, check transaction and audit history, confirm the application version works with the restored schema, measure the duration and record any data lost, then write down the gaps.

Worked example A full recovery runbook

The table above says what to recover. A runbook says in what order, and what to check before moving on. Here is the Apex runbook for restoring the platform to a time T after a database failure. The order matters: keys before backups, infrastructure before data, the database before the work that depends on it.

StepActionCheck before the next step
1. Declare and freezeDeclare the incident; stop ingestion so the API answers 503 and providers retry later; agree the restore time T with financeNo new writes; T and the decision recorded in the incident log
2. Keys and secretsConfirm the encryption keys are usable and the secrets exist in the recovery environmentA test backup decrypts; every secret the services need is present
3. InfrastructureRecreate the environment from TerraformThe plan matches the code; health checks pass on empty services
4. Database to TPoint-in-time restore of PostgreSQL to TRecord counts and control totals match the last reconciliation report before T; the application version works with the restored schema
5. Settlement filesRe-register files received after T from S3, by checksumEvery file after T has exactly one batch row, and its totals check passes
6. Queue workRe-enqueue payments that are RECEIVED but not processed; republish PENDING outbox rowsThe queue drains; duplicate postings stay at 0, because consumers deduplicate by event ID
7. Payments after TCompare each provider's report for the window after T with stored payments; ask providers to resend the gapStored count equals the provider count for the window; resends answered 202 or 200, never twice
8. Reopen and recordReopen ingestion gradually; record the actual RTO, the data lost in time and count, and every gap in this runbookError rate and oldest message age back to normal; the record signed by the incident lead and finance

Put a price on it What each strategy costs

Each step up the ladder buys a faster recovery with a bigger monthly bill. The amounts below are illustrative assumptions in US dollars, added on top of normal production, for practice only. The recovery times are the usual ranges for each strategy, not promises: only a measured drill tells you yours.

Strategy (illustrative)Added cost a monthOver three yearsUsual recovery time
Backup and restore$400$14,400Hours
Pilot light$1,500$54,000Tens of minutes
Warm standby$5,000$180,000Minutes
Multi-site active$14,000 and up$504,000 and upNear zero, with conflict handling to build

Now apply the example objectives: RPO 15 minutes, RTO 2 hours. Point-in-time recovery meets the RPO in every row. So the question is whether the cheapest strategy meets the RTO. In the sample restore record below, the database restore took 47 minutes. If the whole runbook, steps 1 to 8, fits comfortably inside 2 hours in a drill, backup and restore is the answer, and it saves about $39,600 over three years compared with pilot light. If the drill takes 1 hour 50 minutes, the margin is too thin: propose pilot light, and show the drill result as the reason.

Practice Design and test recovery

Practical exercise

Exercise 10: the Apex recovery plan

With example objectives RPO 15 minutes and RTO 2 hours, design recovery for five scenarios and run one restore.

  1. Database failure and accidental data deletion.
  2. Object storage corruption or deletion.
  3. A regional disruption and compromised deployment credentials.
  4. Restore the database into an isolated environment and record the actual time.
Show a sample restore record
  • Restore: point-in-time to 14:05; finished in 47 minutes; 0 records missing against the 14:05 control totals.
  • Gap: the runbook missed re-pointing the worker’s secret; added and retested.

3 questions

Check your understanding

1. An agreed RPO is 15 minutes. What does that limit?
2. Which disaster recovery strategy should you choose?
3. Put these recovery steps in the order the Apex runbook uses.

Use the arrows to put the steps in order, first at the top.

  1. Re-register settlement files and rebuild the queue work
  2. Close the gap after T with the providers, then reopen ingestion
  3. Recreate the infrastructure from code
  4. Restore the database to time T and check the control totals
  5. Confirm the encryption keys and secrets are usable
Answer every question to submit.

What you can do now

  • Explain RPO and RTO.
  • Design backup protections.
  • Run and record a restore exercise.