Find a course

Module 3: Reliability and ScaleLesson 8 of 1211 min

Backups and Disaster Recovery

Define RPO and RTO, apply the 3-2-1 backup rule in the cloud, and compare disaster recovery strategies from backup-and-restore to multi-site active-active.

Step 1 of 14Learn

The script that deleted production

At 4:40 p.m. on a Friday, an engineer at a software company ran a cleanup script against what she thought was the test database. It was production. Two years of customer records vanished in seconds. The database was highly available, replicated across three zones, and the replication faithfully deleted the data in all three.

High availability protects against infrastructure failure. It does nothing against data loss from human error, buggy code, ransomware or a malicious insider. For that you need backups and a disaster recovery (DR) plan.

Two numbers define what "recovery" must mean for each system:

  • RPO (recovery point objective): the maximum amount of data you can afford to lose, measured in time. An RPO of 1 hour means backups or replication must capture changes at least every hour; after a disaster, you might lose up to the last hour of data.
  • RTO (recovery time objective): the maximum time the system can be down before it's restored. An RTO of 4 hours means the service must be running again within 4 hours of the incident.

Both are business decisions, not technical ones. Ask the owners: "How much data can we lose? How long can customers wait?" A blog might accept an RPO of 24 hours and an RTO of a day; a payment system might need an RPO of seconds and an RTO of minutes. Lower numbers cost more.

Step 2 of 14Practice · Match the pairs

Match each term to its meaning.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. RPO
  2. RTO
  3. High availability
  4. Backup

Step 3 of 14Practice · Work it out

A database is backed up every 6 hours, at 00:00, 06:00, 12:00 and 18:00. It is corrupted at 17:30 and restored from the most recent backup. How many hours of data are lost?

Step 4 of 14Timeline

RPO and RTO on one afternoon

  1. 12:00
    Last good backup
  2. 14:30
    Database corrupted

    Everything written since 12:00 is lost: 2.5 hours of data. RPO measures this.

  3. 16:00
    Service restored

    1.5 hours of downtime. RTO measures this.

Step 5 of 14Learn

Backups that actually work

The classic guideline is the 3-2-1 rule: keep at least 3 copies of your data, on 2 different types of storage, with 1 copy offsite. In the cloud, a modern version looks like this:

  • The live data in your database or storage.
  • Automated snapshots or backups in the same region, for fast restores of everyday mistakes.
  • A copy in another region, and ideally in a separate account with different credentials, so a compromised admin account or a regional disaster can't destroy everything.

Ransomware has added a fourth idea: immutable backups. Many cloud storage services offer write-once settings (often called object lock) that prevent anyone, even an administrator, from deleting or altering backups for a set retention period. Attackers increasingly target backups first, so this matters.

Other essentials:

  • Point-in-time recovery: managed databases can often restore to any second within a retention window, which handles "the bad script ran at 4:40 p.m." perfectly.
  • Retention policies: how long to keep daily, weekly and monthly backups, balanced against cost and legal requirements.
  • Test restores. A backup that has never been restored is a hope, not a backup. Schedule regular restore tests and measure how long they take; that measurement tells you whether you can meet your RTO.

Step 6 of 14Practice · Diagram

The 3-2-1 rule

Tap the part that protects you if a whole region goes down.

Tap the shape that answers the question, then press Check.

The 3-2-1 ruleParts diagram: 3-2-1, 3 copies, 2 storage types, 1 offsite.3-2-13 copies2 storagetypes1 offsite
3-2-1
3 copies

The live data plus at least two backups.

2 storage types

For example block snapshots and object storage.

1 offsite

In the cloud: another region and ideally another account.

Step 7 of 14Practice · Put in order

Put these steps for setting up a sound backup plan in a sensible order.

Drag the items, or use the arrow buttons, to put them in order.

  1. Copy backups to another region and a separate account, with immutability
  2. Run a test restore and time it
  3. Configure automated backups at a frequency that meets the RPO
  4. Agree on RPO and RTO with the system's business owner
  5. Adjust the plan if the restore time exceeds the RTO

Step 8 of 14Learn

Disaster recovery strategies

For larger failures, such as losing a whole region, organizations choose a DR strategy based on their RPO, RTO and budget. Four common strategies, from cheapest and slowest to most expensive and fastest:

  1. Backup and restore. Keep backups in another region; after a disaster, build the infrastructure and restore data there. Lowest cost, but RTO is hours to a day or more. Infrastructure as code makes rebuilding much faster.
  2. Pilot light. Keep the critical core, especially databases replicating continuously, running in the second region at minimal size, with everything else ready to switch on. RPO of minutes; RTO of tens of minutes to hours.
  3. Warm standby. Run a scaled-down but fully working copy of the whole system in the second region. In a disaster, scale it up and redirect traffic. RTO of minutes.
  4. Multi-site active-active. Run full capacity in two or more regions at once, serving users from all of them. A region failure means traffic simply shifts to the others. Near-zero RTO and RPO, at roughly double the cost and with significant design complexity, especially for keeping data consistent.

Whatever the strategy, practice it. Run DR drills, document the runbook step by step, and know who decides to fail over. Many real disasters turned into long outages not because the technology failed, but because nobody had ever tried the failover and the steps didn't work as written.

Step 9 of 14Practice · Sort into groups

Sort each scenario by the DR strategy it describes.

Tap an item, then tap its group (or drag it there).

Step 10 of 14Diagram

Disaster recovery: cost vs speed

Disaster recovery: cost vs speedScale: Backup and restore, Pilot light, Warm standby, Multi-site active-active.02468101.5Backup and restore4Pilot light6.5Warm standby9.5Multi-siteactive-active

Tap a shape with to see more.

Further right = faster recovery and higher cost. Positions are illustrative.
Backup and restore

Lowest cost; RTO hours to a day or more.

Pilot light

Core database replicating; RTO tens of minutes to hours.

Warm standby

Scaled-down full copy; RTO minutes.

Multi-site active-active

Near-zero RTO and RPO; about double the cost.

Step 11 of 14Note

Step 12 of 14Practice · True or false

Replicating a database to a second availability zone protects you from an accidental DELETE that removes customer records.

Step 13 of 14Note

Step 14 of 14Practice · What would you do?

What would you do?

A company's customer portal has an RTO of 15 minutes and an RPO of 1 minute. Today it relies on nightly backups stored in the same region. What is the most appropriate improvement?