By the end you'll know
- What RPO and RTO mean, how to measure them, and why they're business decisions before they're technical ones
- The four disaster recovery strategies, from backup and restore to active-active, and what each costs
- How AWS Backup works: vaults, plans, rules and selections by tag
- How to restore, what a restore doesn't bring back, and why an untested backup is only a hope
- How backups are protected from the people, and the attackers, who might delete them
Before you start
- You need: the
juniper-ryeprofile from Lesson 4, signed in, and Lessons 15 to 18: the lab protects a DynamoDB table and an S3 bucket. - The script:
backup-lab.shfrom the practice folder'slesson-19. Everything it creates is namedjr-lesson19-*, and itsdeletestep removes it, backups included. - How the script talks to AWS: only through the AWS CLI. The few lines of Python in it just turn the CLI's JSON into readable tables and never connect to AWS; boto3, AWS's Python library, comes in Lesson 20.
- To see every call the script makes, put
SHOW=1in front of any step, such asSHOW=1 ./backup-lab.sh plan. The lesson's "By hand" section lists them all too. - Where you run things: your own machine, labeled (Your machine).
- Run the steps one at a time, and only go on to
disasteroncebackupsays both jobs finished. The lesson shows why. - Every output below is from real runs on November 11, 2026. The first two runs failed in different ways, and both are in the lesson.
Backups in the same account can be deleted with everything else
Anyone who can delete your data in an account can usually delete its backups too, and ransomware attacks go after backups first. This lab keeps backups in the same account, which is fine for practice. Real ones are copied to a separate account, and locked so nobody, not even an administrator, can delete them early.
The short version
- RPO (recovery point objective) is how much data you can afford to lose; RTO (recovery time objective) is how long you can afford to be down. The business sets both; the design has to meet them.
- AWS Backup protects many services under one plan, picking resources by tag, and keeps the backups in a vault.
- A backup captures the data as it was when the job started, even if the job takes half an hour to finish.
- A restore makes new copies, under new names, and needs its own permissions and settings.
- Until you've restored a backup, you don't know it works. Two of this lesson's three runs proved that.
What this lesson costs
| Part | Cost, in us-east-2 |
|---|---|
| AWS Backup storage | DynamoDB $0.10 and S3 $0.05 per GB a month: this lab stores a few KB |
| Restores | DynamoDB $0.15 per GB, S3 $0.012 per GB: fractions of a cent |
| The table, the buckets and their requests | Well under 1 cent |
| This lesson | Under 1 cent a run, from credits |
The two numbers
Every disaster recovery plan comes down to two questions, asked of the business, not of the engineers:
| RPO, recovery point objective | RTO, recovery time objective | |
|---|---|---|
| Asks | How much data can we lose? | How long can we be down? |
| Measured | Backwards from the disaster, to the last good copy | Forwards from the disaster, to working again |
| Set by | How often you back up or copy | How fast you can restore and switch over |
| For the bakery | "Losing today's orders would hurt; losing a minute's wouldn't" | "The shop can't take orders while it's down" |
Here is the lab's real timeline, with both marked:
Both numbers get smaller as you spend more. Backing up hourly instead of daily shrinks RPO; keeping a second copy running elsewhere shrinks RTO. That's why the business sets them: someone has to decide what an hour of lost orders, or an hour of downtime, is worth.
The four strategies
The Solutions Architect exam names four ways to recover, from cheapest and slowest to dearest and fastest:
| Strategy | What's ready in the second place | RPO | RTO | Cost |
|---|---|---|---|---|
| Backup and restore | Backups only. Everything else is built after the disaster. | Hours | Hours | $ |
| Pilot light | The data, copied continuously; servers defined but off | Minutes | Tens of minutes | $$ |
| Warm standby | A small working copy of everything, scaled up when needed | Seconds to minutes | Minutes | $$$ |
| Multi-site, active-active | A full copy, serving customers all the time | Near zero | Near zero | $$$$ |
This lesson builds the first. Lesson 17's Multi-AZ standby and Lesson 18's global tables are pieces of the others: copies kept ready, rather than rebuilt.
Is it allowed, and what does it cost?
(Your machine)
cd ~/Apps/aws-practice/lesson-19
chmod +x backup-lab.sh
./backup-lab.sh fence
== Is this allowed in us-east-2?
AWS Backup: allowed
AWS Backup may protect DynamoDB: True, S3: True
advanced DynamoDB backups (managed fully by AWS Backup): True
== What it costs, in us-east-2
backup storage: DynamoDB $0.10 per GB a month, S3 $0.05 per GB a month: this lab stores a few KB
restores: DynamoDB $0.15 per GB, S3 $0.012 per GB: fractions of a cent
the table, bucket and requests: well under 1 cent
this lab: under 1 cent, if delete runs the same day
AWS Backup has a per-Region switch for each kind of resource it may protect, the opt-in. Both DynamoDB and S3 were on. "Advanced DynamoDB backups" means AWS Backup manages DynamoDB backups fully, with features like copying them to other accounts.
What to protect, and the plan
In the console: AWS Backup > Backup vaults > Create backup vault; then Backup plans > Create backup plan > Build a new plan; then the plan > Assign resources, with Include specific resource types and a tag condition.
(Your machine)
./backup-lab.sh build
./backup-lab.sh plan
From the third run:
== The orders table, tagged backup=daily
== The recipe bucket, jr-lesson19-recipes-2691a6, with versioning on (AWS Backup needs it for S3), tagged backup=daily
== What there is to protect
jr-lesson19-orders: 1001 sourdough, 1002 baguette, 1003 croissant
jr-lesson19-recipes-2691a6: recipes/croissant.txt, recipes/rye.txt, recipes/sourdough.txt
== A role AWS Backup takes on to back up and restore, with AWS's four managed policies for it
== A backup vault, where the backups are kept, encrypted
== A backup plan: every day at 05:00 UTC, kept 7 days, for anything tagged backup=daily
== The plan
rule daily: cron(0 5 * * ? *), into jr-lesson19-vault, deleted after 7 days
selection tagged-daily: every resource whose tag backup equals daily
| Part | Does | The lab's |
|---|---|---|
| Backup vault | Holds backups, called recovery points, encrypted, with its own access policy | jr-lesson19-vault |
| Backup plan | One or more rules saying when to back up and how long to keep it | jr-lesson19-daily |
| Rule | A schedule, a vault, and a lifecycle | 05:00 UTC daily, kept 7 days |
| Resource selection | Which resources the plan covers: by name, or by tag | Anything tagged backup=daily |
| Role | What AWS Backup acts as when it backs up and restores | jr-lesson19-backup-role, with AWS's four managed policies for backups, restores, and S3's of each |
Selecting by tag is the habit worth copying. The plan names nothing: tag a new table or bucket backup=daily, and tomorrow's run includes it. Nobody has to remember to add it to the plan, and in a real account a rule can require the tag on every new resource (Lesson 35).
The schedule is a cron expression, like Linux's from the Linux track's Scripts and cron, with AWS's extra field for the year. S3 needs versioning on before AWS Backup will protect a bucket.
Backing up, and the shop keeps trading
In the console: AWS Backup > Protected resources > Create on-demand backup.
(Your machine)
./backup-lab.sh backup
== Backing up both now, on demand, rather than waiting for 05:00
DynamoDB COMPLETED after 188 seconds
S3 COMPLETED after 1563 seconds
both jobs finished at 2026-11-11T20:11:04Z
== The vault now: each recovery point holds the data as it was when its backup started
DynamoDB recovery point ...6d3a22c0e674 COMPLETED data as of 2026-11-11T19:44:59Z
S3 recovery point ...501-30218f55 COMPLETED data as of 2026-11-11T19:45:00Z
== Business carries on: one more order and one more recipe, after the backup
jr-lesson19-orders: 1001 sourdough, 1002 baguette, 1003 croissant, 1004 rye
jr-lesson19-recipes-2691a6: recipes/croissant.txt, recipes/focaccia.txt, recipes/rye.txt, recipes/sourdough.txt
aws backup start-backup-job --backup-vault-name jr-lesson19-vault --resource-arn "$TABLE_ARN" \
--iam-role-arn "$ROLE_ARN" --lifecycle DeleteAfterDays=7
Two things in that output. The S3 backup took 1,563 seconds, 26 minutes, for three tiny files; the first backup of a bucket is slow whatever its size. And each recovery point holds the data as of when its job started, 19:45, not when it finished at 20:11. That start time is what RPO counts from, which the lab's first run got wrong, as below.
The disaster
(Your machine)
./backup-lab.sh disaster
== 2026-11-11T20:39:43Z: the disaster. The table is deleted, and every version of every recipe with it
table jr-lesson19-orders: deleted
bucket jr-lesson19-recipes-2691a6: 4 object versions deleted, nothing left to undo
the table: gone
the recipes:
The table is gone, and so is every version of every recipe, so Lesson 15's versioning can't help: this is what a careless script, a compromised account or ransomware looks like. Only the vault has copies.
Restoring, and the two numbers
In the console: AWS Backup > Backup vaults > the vault > select a recovery point > Actions > Restore.
(Your machine)
./backup-lab.sh restore
== A bucket to restore the recipes into, jr-lesson19-restored-dec418, with versioning on (the restore requires it)
== Restoring both from the vault
S3: restore started
DynamoDB: restore started
S3: COMPLETED
DynamoDB: COMPLETED
== What came back
jr-lesson19-orders-restored: 1001 sourdough, 1002 baguette, 1003 croissant
jr-lesson19-restored-dec418: recipes/croissant.txt, recipes/rye.txt, recipes/sourdough.txt
== The two numbers that matter
RPO, DynamoDB: data as of 2026-11-11T19:44:59Z, disaster at 2026-11-11T20:39:43Z: 54 min 44 s of changes lost
RPO, S3: data as of 2026-11-11T19:45:00Z, disaster at 2026-11-11T20:39:43Z: 54 min 43 s of changes lost
what was lost: order 1004 and the focaccia recipe, both added after the backups started
RTO: 7 min 55 s from the disaster to both restored (not counting the time to notice it)
aws backup start-restore-job --recovery-point-arn "$TABLE_RECOVERY_POINT" --iam-role-arn "$ROLE_ARN" \
--resource-type DynamoDB --metadata targetTableName=jr-lesson19-orders-restored
aws backup start-restore-job --recovery-point-arn "$BUCKET_RECOVERY_POINT" --iam-role-arn "$ROLE_ARN" \
--resource-type S3 --metadata DestinationBucketName=jr-lesson19-restored-dec418,EncryptionType=original,RestoreACLs=false
Everything the backups captured came back, and nothing after them did. Order 1004 and the focaccia recipe were added after 19:45, so they're the 54 minutes of changes lost: the RPO. Getting back took 7 minutes 55 seconds: the RTO.
Both numbers are kinder than real life. With the daily plan, a disaster at 04:59 loses almost 24 hours of orders: the worst-case RPO is the time between backups. And the RTO here starts the moment of the disaster. A real one also counts the time until someone notices, and the time to point the app at jr-lesson19-orders-restored and the new bucket, since a restore always makes new copies with new names.
| A restore | So |
|---|---|
| Makes new copies, under names you give | The app needs pointing at them, or the data copying back |
| Needs a role with restore permissions | The lab's role had AWS's restore policies, for S3 as well |
| For S3, needs a destination bucket with versioning on | The script made one first |
| Doesn't restore settings around the data | Tags, alarms, recovery settings and access policies, as Lesson 18 saw |
The two runs that went wrong
The output above is from the third run. The first two failed, and each failure is something teams only find by testing.
The first run's S3 restore failed:
S3: FAILED (Cannot restore, as the BucketOwnershipControls of jr-lesson19-restored-4f1f79 do not allow the use of object ACLs.)
AWS Backup copies each object's ACLs, S3's old per-object permissions, and by default tries to restore them. But new buckets have ACLs switched off, as Lesson 15 showed, so there was nowhere to put them, and the whole restore was refused. RestoreACLs=false fixed it. The DynamoDB half restored fine, so a team that only ever tested the table would have learned this during a real disaster.
That run also reported the RPO as 33 seconds, measured from when the backup jobs finished. The real figure was about 27 minutes, from when they started. The script now reads each recovery point's own time.
The second run's S3 backup never started:
aws: [ERROR]: An error occurred (InvalidParameterValueException) when calling the StartBackupJob operation: IAM Role does not have sufficient permissions to execute the backup
The role had been created moments before, and IAM takes a little while before a brand-new role can be used everywhere. Worse, the steps had been pasted in all at once, so disaster ran anyway and deleted the originals with no finished backup of the bucket. In a real system, that's the end of the data. The script now retries while a new role settles in, and refuses to run disaster unless the vault holds a completed backup of both the table and the bucket.
Check that a backup finished, and test that it restores, before you need it. Two runs out of three would have lost data; both were caught because the restore was actually tried.
Keeping backups safe, described
| Feature | Does |
|---|---|
| Cross-account copy | Copies each backup to a vault in a separate backup account, which the production account can't touch |
| Cross-Region copy | Copies to another Region, for a Region-wide disaster. The free plan's one-Region limit stops it here. |
| Vault Lock | Stops anyone deleting backups before their retention ends. In compliance mode, after a grace period, nobody can remove the lock, not even AWS support. |
| Logically air-gapped vault | A vault locked by default and owned by AWS's own account, shared to you, for recovering after an account is compromised |
| Restore testing | Restores chosen backups on a schedule, checks them, and deletes the copies: this lesson's restore, automated |
| Backup Audit Manager | Reports which resources are protected, and whether plans meet rules like "kept 35 days" |
Take it down
In the console: AWS Backup > the vault > select every recovery point > Actions > Delete; then delete the vault and the plan. Delete the tables and buckets from their own consoles.
(Your machine)
./backup-lab.sh delete
== Deleting table jr-lesson19-orders-restored
== Deleted bucket jr-lesson19-recipes-2691a6
== Deleted bucket jr-lesson19-restored-dec418
== Deleted the backup plan
== Deleted 2 recovery points
== Deleted the vault
== Deleted role jr-lesson19-backup-role
== Left over from this lab
tables: 0
buckets: 0
backup plans: 0
backup vaults: 0
IAM role: 0
== Backups that bill, anywhere in us-east-2
DynamoDB backups: 0
backup vaults: 0 (AWS creates an empty Default one when you first open AWS Backup)
A vault can't be deleted while it holds recovery points, or while a backup job is still running in it. The second run's delete hit exactly that, with its half-finished DynamoDB job, so the script now waits for running jobs first. The role goes last, because AWS Backup needs it until every job is done.
By hand: every command the script runs
The same lab without the script, in order. It leaves out tags on the table and bucket, which are set when they're created, and the waiting loops; SHOW=1 ./backup-lab.sh plan prints the exact calls as they run. (Your machine)
export AWS_PROFILE=juniper-rye AWS_REGION=us-east-2
# Check AWS Backup may protect these kinds of resource here
aws backup describe-region-settings
# The role AWS Backup acts as, with AWS's four managed policies
aws iam create-role --role-name jr-lesson19-backup-role \
--assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"backup.amazonaws.com"},"Action":"sts:AssumeRole"}]}'
aws iam attach-role-policy --role-name jr-lesson19-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup
aws iam attach-role-policy --role-name jr-lesson19-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForRestores
aws iam attach-role-policy --role-name jr-lesson19-backup-role --policy-arn arn:aws:iam::aws:policy/AWSBackupServiceRolePolicyForS3Backup
aws iam attach-role-policy --role-name jr-lesson19-backup-role --policy-arn arn:aws:iam::aws:policy/AWSBackupServiceRolePolicyForS3Restore
# The vault, the plan, and the selection by tag
aws backup create-backup-vault --backup-vault-name jr-lesson19-vault
PLAN=$(aws backup create-backup-plan --backup-plan file://plan.json --query BackupPlanId --output text)
aws backup create-backup-selection --backup-plan-id "$PLAN" --backup-selection file://selection.json
# A backup now, and what's in the vault
aws backup start-backup-job --backup-vault-name jr-lesson19-vault --resource-arn "$TABLE_ARN" \
--iam-role-arn "$ROLE_ARN" --lifecycle DeleteAfterDays=7
aws backup start-backup-job --backup-vault-name jr-lesson19-vault --resource-arn "arn:aws:s3:::$BUCKET" \
--iam-role-arn "$ROLE_ARN" --lifecycle DeleteAfterDays=7
aws backup describe-backup-job --backup-job-id "$JOB_ID"
aws backup list-recovery-points-by-backup-vault --backup-vault-name jr-lesson19-vault
# Restoring, each to a new name
aws backup start-restore-job --recovery-point-arn "$TABLE_RECOVERY_POINT" --iam-role-arn "$ROLE_ARN" \
--resource-type DynamoDB --metadata targetTableName=jr-lesson19-orders-restored
aws backup start-restore-job --recovery-point-arn "$BUCKET_RECOVERY_POINT" --iam-role-arn "$ROLE_ARN" \
--resource-type S3 --metadata DestinationBucketName="$NEW_BUCKET",EncryptionType=original,RestoreACLs=false
aws backup describe-restore-job --restore-job-id "$RESTORE_JOB_ID"
# Taking it down: tables and buckets, then the plan, the recovery points, the vault, and the role last
aws backup delete-backup-selection --backup-plan-id "$PLAN" --selection-id "$SELECTION_ID"
aws backup delete-backup-plan --backup-plan-id "$PLAN"
aws backup delete-recovery-point --backup-vault-name jr-lesson19-vault --recovery-point-arn "$RECOVERY_POINT"
aws backup delete-backup-vault --backup-vault-name jr-lesson19-vault
plan.json holds the rule shown in the plan output: cron(0 5 * * ? *), the vault, and "Lifecycle": {"DeleteAfterDays": 7}. selection.json holds the role and the tag condition, backup equals daily.
In real systems
- The business signs off RPO and RTO for each system, and the backup plans are written to meet them: hourly or continuous for orders, daily for reports.
- Backups are copied to a separate backup account, often in another Region, locked with Vault Lock, so a compromised production account can't delete them (Lesson 36).
- Restore testing runs on a schedule, and its results go to the team, because a backup that has never been restored is a hope, not a plan.
- A rule requires the backup tag on every database and bucket (Lesson 35), so nothing is left out by accident.
- The recovery runbook is written down and practiced, including how to point the app at restored copies: the part this lab's RTO didn't count.
- The plans, vaults and selections are Terraform, like everything else from Part 5 on.
Spot the problem
Work out what's wrong before you read the explanation.
"Our backups were deleted along with everything else." An attacker gets an administrator's access keys for the bakery's production account. They delete the database, the buckets, and then every recovery point in the backup vault, which is in the same account. The plan ran perfectly every night. What's wrong? The backups lived where the attacker already had full control. Anyone who can delete the data could delete the backups. The fix: copy every backup to a vault in a separate backup account, and lock that vault with Vault Lock, so the production account can't delete the copies, and nobody can delete them early. Then check: from the production account, does deleting a recovery point in the backup account fail with AccessDenied?
Keep this
| Remember | Why |
|---|---|
| RPO: data you can lose; RTO: time you can be down | The business sets them, and they set the cost |
| Worst-case RPO is the time between backups | A daily plan can lose almost a day |
| A backup captures when it starts | The 26-minute S3 job still held 19:45's data |
| Select resources by tag | New resources are protected without editing the plan |
| Restores make new copies | Point the app at them; that's part of the RTO |
| S3 restores into ACL-free buckets need RestoreACLs=false | Or the whole restore is refused |
| Confirm the backup finished before you need it | The second run deleted data with no backup |
| Copy backups to another account, and lock them | Whoever can delete the data can delete local backups |
Where you are now
The bakery has a backup plan that protects anything tagged for it, and you've done what most teams never do: deleted the originals and restored them, measuring 54 minutes of lost changes and 7 minutes 55 seconds to recover. Two broken runs taught you to check a backup finished and to test that it restores. That's the end of Part 3. Part 4 starts with Lesson 20, where the scripts become Python: the same AWS calls, through boto3.
Check yourself
The backup jobs finished at 20:11, and the disaster was at 20:39:43. What was the RPO?
The bakery backs up once a day at 05:00. What's its worst-case RPO?
Why does the lab's plan select resources by tag?
Why did the first run's S3 restore fail?
What did the second run do that a real team must never do?
Which strategy keeps a small working copy running, ready to scale up?
An attacker has admin access to the production account. Where should the backups be?
Key terms
- RPO (recovery point objective): how much data, measured in time, you can afford to lose.
- RTO (recovery time objective): how long you can afford to be down.
- Disaster recovery (DR): getting back after losing a system, a zone, a Region or the data itself.
- Backup and restore, pilot light, warm standby, active-active: the four DR strategies, from cheapest to fastest.
- AWS Backup: one service for backing up many others, on plans.
- Backup vault: where AWS Backup keeps backups, encrypted.
- Recovery point: one backup in a vault.
- Backup plan and rule: when to back up, into which vault, and for how long.
- Resource selection: which resources a plan covers, by name or tag.
- Opt-in: AWS Backup's per-Region switch for each resource type.
- Restore job: creating new copies from a recovery point.
- Vault Lock: stops anyone deleting backups before their retention ends.
- Restore testing: AWS Backup restoring and checking backups on a schedule.
Go deeper
- SQL track: Backups, and restoring them, for what a database backup holds.
- Linux track: Scripts and cron, for the schedule format.
- AWS: disaster recovery options in the cloud (opens in a new tab), AWS Backup pricing (opens in a new tab), and restoring S3 data (opens in a new tab).
- AWS: Vault Lock (opens in a new tab), restore testing (opens in a new tab), and logically air-gapped vaults (opens in a new tab).
- Try: run
build,planandbackup, then rundisasterbefore the backup finishes, from a second terminal, and watch the script refuse. Then letbackupfinish, and rundelete.