Skip to content

Expert · High availability, scaling and disaster recovery · topic 41 of 50 · 35 min

Backups and disaster recovery

Explanation

High availability survives a broken server or zone; backups and disaster recovery (DR) survive deleted data, ransomware and the loss of a whole region. Two numbers drive every DR plan: RPO, how much data you can afford to lose, and RTO, how long you can afford to be down. The four DR strategies, from backup and restore to multi-site active/active, trade cost against those two numbers.

Three different jobs

Protects againstHow
High availabilityA failed server, disk or Availability ZoneRedundant copies running in several AZs, automatic failover
BackupDeleted or corrupted data, bad deploys, ransomwarePoint-in-time copies kept for days, weeks or years
Disaster recoveryLosing a whole region, account or data centreA plan plus backups or standby systems in another region or account

HA is not backup. If someone runs DELETE FROM students by mistake, a Multi-AZ standby deletes the same rows a millisecond later, because it copies every change. Only a backup from before the mistake brings the data back.

RPO and RTO

The recovery point objective (RPO) is the maximum amount of data, measured in time, you can afford to lose. If backups run nightly at 2 am and the disaster hits at 2 pm, you lose 12 hours of data, so your RPO with that design is up to 24 hours. The recovery time objective (RTO) is the maximum time the service may be down before it is working again. If restoring and switching over takes 4 hours, your RTO must be at least 4 hours.

Think of it like this: RPO is "how many pages of my notebook can I afford to lose?" RTO is "how long can I go without my notebook before I fail the exam?" Photocopying every evening gives an RPO of one day; keeping a spare notebook already filled in gives a very short RTO, but costs more.

The four DR strategies

StrategyWhat runs in the recovery regionTypical RPOTypical RTOCost
Backup and restoreOnly backups, copied there regularly. Everything is rebuilt (ideally with IaC) after a disaster.HoursHours to a dayLowest
Pilot lightData is replicated live; core pieces such as the database run, but app servers are off or at zero until needed.MinutesTens of minutes to a few hoursLow to medium
Warm standbyA smaller but fully working copy of the whole system, scaled up when needed.Seconds to minutesMinutesMedium to high
Multi-site active/activeThe full system serves real users in two or more regions at once.Near zeroNear zeroHighest

Pick the cheapest strategy that meets the RPO and RTO the business has agreed. A college library catalogue can live with backup and restore. A stock broker's order system may need multi-site.

AWS Backup

AWS Backup is a central service that backs up many AWS services (such as EBS volumes, EC2, RDS and Aurora, DynamoDB, EFS and S3) from one place. A backup plan holds rules: how often (for example daily at 1 am), how long to keep each backup, and when to move older ones to cheaper cold storage. Resources are assigned to a plan by tag (for example backup=daily) or by ID. Backups are stored in a backup vault, an encrypted container with its own access policy. Copy rules can copy backups to a vault in another region and, with AWS Organizations, to another account.

bash
aws backup list-backup-plans
aws backup start-backup-job --backup-vault-name results-vault \
  --resource-arn arn:aws:rds:ap-south-1:111122223333:db:results-db \
  --iam-role-arn arn:aws:iam::111122223333:role/service-role/AWSBackupDefaultServiceRole
Listing plans and starting an on-demand backup, for example just before a risky database migration.

Snapshots, versioning and replication

A snapshot is a point-in-time copy of a disk or database. EBS snapshots are incremental (only changed blocks are stored after the first one) and can be copied to another region. RDS automated backups let you restore a database to any second within the retention period (1 to 35 days); a restore always creates a new database instance, so the application must be pointed at it.

For S3, versioning keeps every old version of an object, so an overwrite or delete can be undone. Replication copies new objects to another bucket, for example Cross-Region Replication from Mumbai to Hyderabad; it needs versioning on both buckets. Check how your replication rules handle deletes, so a mistaken delete is not simply copied too.

The 3-2-1 rule and ransomware

The classic 3-2-1 rule says: keep 3 copies of important data, on 2 different kinds of storage, with 1 copy off-site. In the cloud, "off-site" means another region and, ideally, another account. Ransomware attackers who steal admin credentials try to delete backups before they encrypt your data. Defend with immutable backups, which cannot be changed or deleted until their retention ends. AWS Backup Vault Lock locks a vault so that, in compliance mode, nobody, not even the root user, can delete backups early or shorten retention. S3 Object Lock does the same for objects in a versioned bucket (write once, read many). Add a separate backup account with very few people allowed in, MFA, and alerts on backup deletion.

Test your restores

A backup you have never restored is only a hope. Schedule restore drills: restore last night's database into a test account, check the row counts, time how long it took, and compare that with your RTO. AWS Backup has a restore testing feature that automates part of this. Once or twice a year, run a "game day" where the team practises failing over to the recovery region.

Careful: Common mistakes: (1) Treating Multi-AZ or replication as a backup. Fix: keep point-in-time backups too. (2) Backups in the same account and region as production, so one stolen key or one regional event loses both. Fix: copy to another region and account. (3) Never testing a restore, then finding during a crisis that it takes 14 hours. Fix: regular drills that measure real RTO. (4) Retention too short to notice slow, silent corruption. Fix: keep weekly and monthly backups for longer. (5) Forgetting what is not data: IaC code, DNS settings, secrets and runbooks also need to be recoverable.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Backups and disaster recovery · 1/8

HA ≠ backup ≠ DR

High availability survives a broken server or zone. Backups and disaster recovery survive deleted data, ransomware and losing a whole region.

Prefer a video by a teacher? Find free videos on “aws disaster recovery strategies rpo rto pilot light warm standby aws backup” on YouTube ↗

In real life: A co-operative bank in Gujarat plans for a regional outage

A co-operative bank runs its internet banking on AWS in Mumbai. Regulators and the board agree on an RPO of 15 minutes and an RTO of 2 hours. Backup and restore cannot meet that, and multi-site active/active is more than they can afford, so they choose pilot light: the database replicates continuously to the Hyderabad region, the app tier is defined in Terraform with zero instances there, and AWS Backup copies daily backups to a locked vault in a separate backup account. Every quarter they run a failover drill; the last one took 74 minutes.

Practice (0/3 done)

Task 1 · Question

Backups run every 6 hours. A disaster happens just before the next backup. Roughly how much data could be lost?

Task 2 · Code · Python

Write choose_dr(rpo_minutes, rto_minutes) that returns the name of the CHEAPEST strategy in STRATEGIES whose rpo and rto are both less than or equal to the targets. Each entry is (name, rpo_minutes, rto_minutes, monthly_cost_in_rupees); the numbers are illustrative. Return None if no strategy meets the targets. Keep the STRATEGIES list in your code.

Task 3 · Practice

Write a backup and DR plan for a small hospital's patient appointment system on AWS (a web app on EC2, an RDS PostgreSQL database and scanned documents in S3). The hospital agrees on an RPO of 1 hour and an RTO of 8 hours.

Quick quiz

Question 1

1.What does RTO measure?

Question 2

2.In which DR strategy is a smaller but fully working copy of the whole system always running in the recovery region?

Question 3

3.A developer accidentally deletes a table. The database is RDS Multi-AZ. What recovers the data?

Question 4

4.Which feature stops anyone, even an administrator, from deleting backups before their retention ends?

Question 5

5.What does the 3-2-1 backup rule say?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

What does RTO measure?

Answer: How long the service can be down before it must be working again

Recovery time objective: the maximum acceptable downtime. RPO is about data loss.

In which DR strategy is a smaller but fully working copy of the whole system always running in the recovery region?

Answer: Warm standby

Warm standby runs a scaled-down full copy that is scaled up during a disaster.

A developer accidentally deletes a table. The database is RDS Multi-AZ. What recovers the data?

Answer: A point-in-time restore from backups taken before the delete

The standby copied the delete too. Only a backup from before the mistake has the data.

Which feature stops anyone, even an administrator, from deleting backups before their retention ends?

Answer: AWS Backup Vault Lock in compliance mode

Vault Lock (and S3 Object Lock in compliance mode) make backups immutable, which protects against ransomware.

What does the 3-2-1 backup rule say?

Answer: 3 copies of data, on 2 kinds of storage, with 1 copy off-site

Three copies, two media, one off-site. In the cloud, off-site means another region and ideally another account.

What is the maximum retention period for RDS automated backups?Related

Answer: 35 days

Automated backup retention can be set from 1 to 35 days. Use manual snapshots for longer.

From Managed relational databases: RDS and Aurora

What must be true before you set up S3 Cross-Region Replication?Related

Answer: Versioning is enabled on both buckets

Replication requires versioning on the source and the destination bucket.

From Amazon S3: buckets, objects and storage classes

What does "incremental" mean for EBS snapshots?Related

Answer: After the first, only changed blocks are stored

Later snapshots store only blocks that changed since the previous one, which saves cost.

From Block and file storage: EBS, instance store and EFS

What is the best proof that your backups work?Related

Answer: Regularly restoring a backup to a test server and checking the data

Only a restore drill proves you can get the data back, and how long it takes.

From Choosing a database, and keeping it safe

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 1 more topic in “High availability, scaling and disaster recovery” before its exam: The Well-Architected Framework.
  2. Module 10 exam: High availability, scaling and disaster recovery · 13 questions · 25 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Cloud security and compliance. 50 topics left in the course before the final exam.

← Previous: Load balancing and auto scaling