Disaster Recovery: RTO, RPO and Restore Drills
Open in the interactive app: practice, quiz, mock interview →In one minute
- Disaster recovery (DR) is what you do when the normal redundancy is not enough: a region is down, a database is corrupted, ransomware encrypted your storage, or someone deleted the production account.
- Two numbers define it. RPO (recovery point objective): how much data you can afford to lose, measured in time. RTO (recovery time objective): how long you can afford to be down.
- Strategies trade cost for those numbers: backup and restore (hours, cheap), pilot light, warm standby, and multi-site active-active (seconds, expensive). Pick per system, by business impact.
- Backups you have not restored are hopes, not backups. Run restore drills on a schedule, measure the real RTO and RPO, and fix what the drill reveals.
- Keep at least one copy out of reach: separate account, immutable storage, different region. The same credentials that can break production must not be able to delete the backups.
How it works
RPO and RTO
RPO is set by how often you capture data and ship it somewhere safe. Nightly backups give an RPO of up to 24 hours; continuous log shipping gives seconds to minutes. RTO is set by how long it takes to get a working system: provision infrastructure, restore data, replay logs, verify, switch traffic. Both should come from the business: what does an hour of downtime cost, and what does losing an hour of orders cost? Different systems get different targets; the payments ledger and the internal wiki should not share a DR plan.
Strategies
AWS's Well-Architected guidance lists four strategies in increasing order of cost and complexity and decreasing RTO and RPO; they apply on any platform (AWS Well-Architected REL13-BP02):
- Backup and restore: data backed up to another region or account; infrastructure rebuilt from code when needed. RPO in hours, RTO of 24 hours or less. Cheapest. Continuous backups with point-in-time recovery can bring RPO down to about 5 minutes.
- Pilot light: data replicated continuously to the recovery region, core infrastructure such as databases running but application servers off. RPO minutes, RTO tens of minutes. The recovery site cannot take traffic until you start servers and scale up.
- Warm standby: a scaled-down but fully working copy running in the recovery region, scaled up on failover. RPO seconds, RTO minutes. Unlike pilot light it can serve traffic at reduced capacity straight away; at full size it is called hot standby.
- Multi-site active-active: full capacity in two or more regions serving traffic. RPO near zero (depending on replication), RTO near zero. Most expensive and complex, especially for writes: conflicting writes to the same record in two regions must be avoided or resolved.
One trap applies to all four: replication copies mistakes as faithfully as data. A replica will happily replicate a DROP TABLE or a corrupted write, so you also need versioning or point-in-time recovery, and backups of the replicated data in the recovery site (same AWS page). Google's SRE book argues for the same layering: soft deletion first, then backups, then archives, and it says to deliver a recovery system, not a backup system, because what users need is the restore (SRE book, ch. 26).
What a disaster takes with it
A DR plan fails most often on what it forgot. If your identity provider, DNS, secrets manager, container registry, CI system or monitoring live in the failed region or account, you may not be able to log in, deploy or see anything. List every dependency of the recovery procedure itself, and make sure each is available in the disaster scenario. AWS lists "dependency on control plane operations during recovery" as an anti-pattern: during a regional event the control plane is the part most likely to be struggling, so failover should use data plane operations and be scripted so that manual initiation is a push of a button. Automatic failover on health checks is risky for the opposite reason, since a false alarm costs availability and data (AWS REL13-BP02). Plan failback as well: re-synchronising the old primary is the hard part, and some teams simply promote the recovery region and rotate roles on a schedule.
The 3-2-1 rule and immutability
Keep at least three copies of important data, on two different kinds of storage, with one off-site. Today "off-site" means another region and, more importantly, another security boundary: a separate cloud account with its own credentials, and immutable storage that cannot be deleted before its retention period. With S3 Object Lock that guarantee holds only in compliance mode, where no user, including the account's root user, can overwrite or delete a locked version; the only way to remove it early is to delete the whole AWS account. Governance mode can be bypassed by principals with special permissions (S3 Object Lock docs). Ransomware and destructive mistakes, by humans or agents, target the same credentials that manage production.
Restore drills
A restore drill is a scheduled, realistic recovery: restore last night's backup into a clean environment, bring the application up, run checks, and time every step. Drills find the problems that make real recoveries fail: backups that were never completing, missing encryption keys, runbooks that reference retired tools, restores that take 14 hours instead of 2. Record measured RTO and RPO and compare them with targets.
The same shape everywhere
DR is the partial-failure shape at the largest scale: you lose a whole failure domain and must continue from what survived elsewhere. Businesses plan the same way for losing an office, a supplier or a key person: decide acceptable loss and downtime, keep copies elsewhere, and rehearse.
Down the stack
Layer 1The contract
Each system has documented RPO and RTO targets agreed with the business, a recovery runbook, backups stored in a separate security boundary, and a drill record showing measured RPO and RTO within targets at least once a year (quarterly for critical systems).
Layer 2The mechanism
Database backups combine base backups with continuous change capture. In Postgres, a base backup (for example from pg_basebackup or a managed snapshot) plus archived WAL segments allows point-in-time recovery to any moment since the base backup (Postgres docs); RPO is bounded by how often WAL is archived (archive_timeout forces a segment switch after that many seconds of activity, because the archive command only runs on completed segments (Postgres docs); for example every 60 seconds). Cross-region replicas ship WAL continuously and are usually seconds behind. Object storage can replicate across regions asynchronously. Infrastructure as code (Terraform, CloudFormation) lets you rebuild networks, clusters and services in a new region from versioned definitions. Traffic moves by DNS changes or global load balancers.
Layer 3The machine
Restore time is mostly bytes over bandwidth and log replay. Copying a 2 TB backup across regions at a sustained 500 MB/s takes about 70 minutes; at 100 MB/s, nearly 6 hours. Replaying a day of WAL depends on write volume and disk speed: a database that writes 50 GB of WAL a day may replay at 100 to 200 MB/s on fast SSDs, so about 5 to 10 minutes, but replay applies records in order and can be slower with many random page reads; recent Postgres versions can prefetch referenced blocks during recovery (recovery_prefetch, on by default where the OS supports it), which helps with that I/O wait (Postgres docs). DNS failover is bounded by record TTLs: clients and resolvers may keep the old address until the TTL expires, so a 300-second TTL means up to 5 minutes of traffic going to the dead region.
Why it's built this way
- Redundancy within a region does not cover regional, account-level or logical disasters.
- Copies elsewhere bound data loss (RPO), and rebuild speed bounds downtime (RTO).
- Faster recovery costs more, so targets come from business impact per system.
- Recovery procedures rot as systems change, so only drills prove they work.
- Attackers and mistakes reach whatever production credentials reach, so backups must live beyond them.
Diagram
flowchart LR
P["Primary region"] -->|"base backup nightly"| B["Backup account, immutable"]
P -->|"WAL every 60 s"| B
P -->|"async replica"| W["Warm standby region"]
D["Disaster in primary"] --> F{"Strategy"}
F -->|"warm standby"| W
F -->|"backup and restore"| R["Rebuild from IaC, restore, replay WAL"]
W --> T["Shift traffic: DNS or global LB"]
R --> TWorked example
An e-commerce company sets targets with the business: checkout and orders RPO 5 minutes, RTO 1 hour; product catalogue RPO 24 hours, RTO 4 hours; internal analytics RPO 24 hours, RTO 3 days. Current state: one region, nightly snapshots in the same account.
For orders, they add continuous WAL archiving every 60 seconds to an immutable bucket in a separate account and region, plus a cross-region read replica that can be promoted (warm standby for the database, pilot light for the application). For the catalogue, nightly backups copied to the backup account. Analytics stays as is.
The first drill simulates losing the primary region. Results: database promotion in the recovery region took 4 minutes; but deploying the application took 48 minutes because the container images were only in the primary region's registry, and the team could not log in to the cloud console for 15 minutes because single sign-on depended on a service in the failed region. Measured RTO: 1 hour 25 minutes, over target. Fixes: replicate images to the recovery region, a break-glass login path independent of the primary region, and pre-provisioned application capacity at 10 percent. The second drill measures 22 minutes.
In the wild
- GitLab, 2017: the backups that did not work. After a replication problem, an engineer removed the data directory on the primary instead of the secondary, deleting about 300 GB. The daily
pg_dumphad been failing because the tool was version 9.2 against a 9.6 database, so the S3 bucket was empty. The team restored from an LVM snapshot taken about 6 hours earlier, so data from that window was lost. Lesson: a backup that has never been restored is a hope, and failure notices must reach someone (GitLab). - Atlassian, 2022: DR built for the wrong disaster. On 5 April a deletion script was given the IDs of whole customer sites and deleted 883 sites (775 customers) in 23 minutes. No customer lost more than five minutes of data, yet some waited up to 14 days, because Atlassian could recover a single site but had not built tooling to restore a large batch. Teams had to parallelise and automate restoration during the incident. Atlassian committed to soft deletes everywhere and to regular DR exercises that restore many sites at once (Atlassian).
- Meta, 2021: recovery tools behind the outage. A backbone maintenance command cut every backbone link, and Meta's DNS servers withdrew their BGP routes when they could no longer reach the data centres. Remote access and internal tools also depended on the same network, so engineers had to go on site, and services returned gradually so that the returning load would not overwhelm power and caches (Meta engineering).
Trade-offs
| Strategy | RPO | RTO | Cost | Choose when |
|---|---|---|---|---|
| Backup and restore | Hours | Hours to a day | Low | Internal or non-urgent systems |
| Pilot light | Minutes | Tens of minutes | Medium | Important systems with tolerance for some downtime |
| Warm standby | Seconds to minutes | Minutes | Higher | Revenue-critical systems |
| Multi-site active-active | Near zero | Near zero | Highest, complex | Systems where any downtime is unacceptable |
Pitfalls in production
- Backups never restored. Fix: scheduled drills with measured RTO and RPO.
- Backups deletable by production credentials. Fix: separate account, immutable storage, retention locks.
- Recovery depends on the failed region (SSO, DNS, registry, secrets). Fix: list and replicate recovery dependencies, break-glass access.
- One DR target for everything. Fix: tier systems by business impact.
- Runbooks that drift from reality. Fix: update after each drill; drills are the test suite for runbooks.
Leadership lens
- Get RPO and RTO targets from the business in money terms, then price each strategy against them.
- Own the drill calendar: critical systems quarterly, others yearly, with results reported to leadership.
- Treat backup deletion protection as a security control, reviewed like IAM.
- Include agents and automation in the threat model: anything with production write access should not reach the backups.
Check yourself
Nightly backups at 02:00, no log shipping. A disaster happens at 23:00. What is the data loss?
Show answer
About 21 hours: everything written since the 02:00 backup, which far exceeds most RPO targets for transactional data.
Why can DNS failover take longer than the DNS change itself?
Show answer
Resolvers and clients cache records until the TTL expires, so some traffic keeps going to the old address for up to the TTL.
Why keep backups in a separate account with immutability?
Show answer
So that compromised or mistaken production credentials, including those used by agents, cannot delete or encrypt them.
What does a restore drill measure that a backup job's success status does not?
Show answer
Whether the backup can actually be restored into a working system, and how long it takes end to end, including dependencies and human steps.
Sources and further study
Primary
- GitLab: postmortem of the 31 January 2017 database outage: a first-hand account of backups that did not work.
- Atlassian: April 2022 outage post-incident review: why single-site restore tooling did not scale to 775 customers.
Systems docs
- AWS Well-Architected REL13-BP02: use defined recovery strategies: the four strategies, their RTO and RPO ranges, failover and failback.
- PostgreSQL: WAL configuration:
archive_timeoutandrecovery_prefetch.
Books
- Site Reliability Engineering, Beyer et al.: chapter 26 (Data Integrity: What You Read Is What You Wrote), including recovery systems and defense in depth, and chapter 33 (Lessons Learned from Other Industries) on disaster testing.
- Building Secure and Reliable Systems, Adkins et al.: chapter 16 (Disaster Planning) and chapter 18 (Recovery and Aftermath).
- Designing Data-Intensive Applications (1st ed.), Kleppmann: chapter 5 (Replication), for why replicas do not replace backups.
Other curricula
- Google SRE book: Lessons Learned from Other Industries: frames disaster testing (DiRT) as running real drills, because thought exercises alone are not enough.
Free resources
- Disaster recovery options in the cloud (AWS whitepaper): backup and restore, pilot light, warm standby and multi-site.
- Disaster recovery planning guide (Google Cloud): RTO, RPO and patterns.
- Disaster recovery (Azure Well-Architected): planning and testing guidance.
- Continuous archiving and point-in-time recovery (PostgreSQL): the mechanism behind low database RPO.
- S3 Object Lock (AWS): immutable backups that even administrators cannot delete early.
- The 3-2-1 backup strategy (Backblaze): the classic rule and its modern variants.