AWS Backup: plans, vaults, restore tests

Everyone has backups until the day they need one. An AWS Backup plan takes backups on a schedule, keeps them as long as your policy says and stores them in a vault you control, but what counts at work is whether you can restore, so this lesson spends as much time on restoring as on backing up.

You’ll create a vault and a daily plan that picks servers by tag, take an on-demand backup of a server holding some “order” data, and restore it as a new server in another zone. After you’ve checked the data line by line, you’ll fix the two problems that make restores fail right when people are already under pressure.

TimeYou needBy the end you can
75 minutes (two small instances and the Session Manager endpoints for about an hour)saat-vpc, Start-SsmEndpoints.ps1 and Stop-SsmEndpoints.ps1, saat-ec2-ssm-profile, your laptop signed in as saat-admin. Cost: about USD 0.15 (an 8 GiB snapshot for an hour, instances and endpoints).Create a backup vault, a plan and a tag-based selection, run and watch a backup job, restore an EC2 instance with the right IAM permissions, check the data, and clean up the recovery points.

What it is, in one line

An AWS Backup plan sets when resources get backed up, which resources (by tag or ID), which vault holds the recovery points, and how long they’re kept.

In Simple Words

Photocopies in a fire-proof cabinet

Think of a small shop with a sales register. Every night at closing the owner photocopies the day’s pages and locks them in a fire-proof cabinet, and copies older than five weeks get shredded, so that routine is the backup plan and the cabinet is the vault. A photocopy too faint to read is no use, though, so once a month the owner pulls one out and checks every line can be read, which is a restore test. And if only one person has the cabinet key and they’re away on holiday, the copies might as well not exist.

Engineer's View

How AWS Backup really works

A backup plan is made of rules, and each rule has a schedule (cron in UTC or in a time zone you set), start and completion windows, a lifecycle (delete after N days, or move to cold storage) and, if you want, copies to another Region or account. A selection picks resources by tag, ARN or both, using an IAM role that AWS Backup assumes. Recovery points sit in a vault encrypted with a KMS key, and Vault Lock adds write-once retention that in compliance mode not even an administrator can shorten.

For EC2 a recovery point is an AMI plus its EBS snapshots, and for EBS, RDS, EFS, DynamoDB and S3 it’s each service’s own backup format, all managed from one place. By default backups are crash-consistent, and for SQL Server on EC2 you can use Windows VSS to get application-consistent ones.

A restore always creates a new resource, from metadata you can override such as the subnet, security groups and instance type. If you restore an instance along with its IAM instance profile, you need iam:PassRole on that role, and the managed restore policy doesn’t give you that. Restore testing can run scheduled, automated restores and validate them for you.

How it works, step by step

This is what protects bk01 in the lab.

1The plan says when

Rule daily-35d runs at 20:30 UTC (02:00 IST). It has to start within an hour and finish within three, and it keeps each recovery point for 35 days.

AWS Backup plan flow: plan, tag selection, vault, restore

2The selection says what

Anything tagged Backup=daily is included, so new servers with that tag get protected without anyone doing anything, and that’s why selecting by tag works better than keeping lists of IDs.

3The vault stores it

Every backup turns into a recovery point in saat-vault, which for EC2 means an AMI with its snapshots.

4A restore proves it

You restore into a different zone and read the data back. These are the rule settings you’ll want to look at in every plan:

AWS Backup plan rule settings: schedule, lifecycle, vault and copies

Copying to another Region or account covers you for the two worst cases, which are losing a whole Region, or an attacker with admin rights in your account deleting the backups as well.

✅ Checkpoint: You can explain plan, rule, selection, vault and recovery point, and why a restore needs iam:PassRole when there’s an instance role.

Hands-on lab: an AWS Backup plan and a real restore test

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Start as usual:

cd C:\aws-lab
aws login --profile saat-admin
$env:AWS_PROFILE = 'saat-admin'
$v = Get-Content C:\aws-lab\saat-vpc.json | ConvertFrom-Json
$acct = aws sts get-caller-identity --query Account --output text
.\Start-SsmEndpoints.ps1

1Create the backup role and vault

Paste this whole block:

'{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "backup.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }' | Set-Content backup-trust.json
$role = aws iam create-role --role-name saat-backup-role --assume-role-policy-document file://backup-trust.json --tags Key=course,Value=saatvedha-aws --query Role.Arn --output text
aws iam attach-role-policy --role-name saat-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup
aws iam attach-role-policy --role-name saat-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForRestores
aws backup create-backup-vault --backup-vault-name saat-vault --backup-vault-tags course=saatvedha-aws --query BackupVaultName --output text

You should see this:

saat-vault

The vault uses the AWS managed key for AWS Backup. Companies often give each vault its own customer managed KMS key (Lesson 30) so that access to backups can be controlled on its own.

2Launch a server with data and a backup tag

Paste this whole block:

$ud = @'
#!/bin/bash
mkdir -p /opt/saat
printf "order 1001 paid 2499\norder 1002 paid 1850\n" > /opt/saat/orders.txt
sync
'@
[IO.File]::WriteAllText('C:\aws-lab\bk-userdata.sh', ($ud -replace "`r`n", "`n"))
$base = aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output text
$i = aws ec2 run-instances --image-id $base --instance-type t3.micro --subnet-id $v.PrivateA --security-group-ids $v.AppSg --iam-instance-profile Name=saat-ec2-ssm-profile --metadata-options HttpTokens=required --user-data file://bk-userdata.sh --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=bk01},{Key=Backup,Value=daily},{Key=course,Value=saatvedha-aws},{Key=lesson,Value=29}]' --query "Instances[0].InstanceId" --output text
do { Start-Sleep 20; $p = aws ssm describe-instance-information --filters "Key=InstanceIds,Values=$i" --query "InstanceInformationList[0].PingStatus" --output text } until ($p -eq 'Online')
aws ssm start-session --target $i --document-name AWS-StartInteractiveCommand --parameters command="cat /opt/saat/orders.txt"

You should see something like this (with the session lines left out):

order 1001 paid 2499
order 1002 paid 1850

3Create the plan and take a backup now

Paste the whole block. The backup normally takes 5 to 15 minutes:

@'
{
  "BackupPlanName": "saat-daily",
  "Rules": [
    {
      "RuleName": "daily-35d",
      "TargetBackupVaultName": "saat-vault",
      "ScheduleExpression": "cron(30 20 * * ? *)",
      "StartWindowMinutes": 60,
      "CompletionWindowMinutes": 180,
      "Lifecycle": { "DeleteAfterDays": 35 }
    }
  ]
}
'@ | Set-Content backup-plan.json
$plan = aws backup create-backup-plan --backup-plan file://backup-plan.json --backup-plan-tags course=saatvedha-aws --query BackupPlanId --output text
@'
{ "SelectionName": "tag-backup-daily", "IamRoleArn": "ROLE_ARN", "ListOfTags": [ { "ConditionType": "STRINGEQUALS", "ConditionKey": "Backup", "ConditionValue": "daily" } ] }
'@ -replace 'ROLE_ARN', $role | Set-Content backup-selection.json
$sel = aws backup create-backup-selection --backup-plan-id $plan --backup-selection file://backup-selection.json --query SelectionId --output text
Start-Sleep 15
$job = aws backup start-backup-job --backup-vault-name saat-vault --resource-arn "arn:aws:ec2:ap-south-1:$($acct):instance/$i" --iam-role-arn $role --lifecycle DeleteAfterDays=7 --query BackupJobId --output text
do { Start-Sleep 30; $st = aws backup describe-backup-job --backup-job-id $job --query State --output text; $st } until ($st -in 'COMPLETED', 'FAILED', 'ABORTED', 'EXPIRED')
aws backup describe-backup-job --backup-job-id $job --query "[State,PercentDone,BackupSizeInBytes]" --output text
$rp = aws backup describe-backup-job --backup-job-id $job --query RecoveryPointArn --output text

You should see something like this:

CREATED
RUNNING
RUNNING
COMPLETED
COMPLETED       100.0   8589934592

Because of its tag, the plan will back up bk01 every night anyway, and the on-demand job only saves you waiting until 2 a.m. The size shows the full 8 GiB volume, even though after the first snapshot only the changed blocks get stored.

AWS Backup plan lab output: backup completed, restore completed, data checked
Backup done, restore done and the data checked. It should look something like this.

4Restore into another zone and check the data

Paste the whole block. The restore takes 5 to 10 minutes:

@'
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::ACCT:role/saat-ec2-ssm-role" } ] }
'@ -replace 'ACCT', $acct | Set-Content passrole.json
aws iam put-role-policy --role-name saat-backup-role --policy-name pass-instance-role --policy-document file://passrole.json
@{ InstanceType = 't3.micro'; SubnetId = $v.PrivateB; SecurityGroupIds = (ConvertTo-Json @($v.AppSg) -Compress); IamInstanceProfileName = 'saat-ec2-ssm-profile'; RequireIMDSv2 = 'true' } | ConvertTo-Json | Set-Content restore-meta.json
Start-Sleep 10
$rj = aws backup start-restore-job --recovery-point-arn $rp --iam-role-arn $role --metadata file://restore-meta.json --resource-type EC2 --query RestoreJobId --output text
do { Start-Sleep 30; $st = aws backup describe-restore-job --restore-job-id $rj --query Status --output text } until ($st -in 'COMPLETED', 'FAILED', 'ABORTED')
aws backup describe-restore-job --restore-job-id $rj --query "[Status,CreatedResourceArn]" --output text
$restored = (aws backup describe-restore-job --restore-job-id $rj --query CreatedResourceArn --output text) -split '/' | Select-Object -Last 1
do { Start-Sleep 20; $p = aws ssm describe-instance-information --filters "Key=InstanceIds,Values=$restored" --query "InstanceInformationList[0].PingStatus" --output text } until ($p -eq 'Online')
aws ssm start-session --target $restored --document-name AWS-StartInteractiveCommand --parameters command="cat /opt/saat/orders.txt"

You should see something like this:

COMPLETED       arn:aws:ec2:ap-south-1:111122223333:instance/i-0c9d8e7f6a5b40061
order 1001 paid 2499
order 1002 paid 1850

You’ve got a new server in ap-south-1b with the same data, and you can reach it through Session Manager because its instance role came back as well. That’s what a tested backup looks like. Note down how long the restore took, because that number is your real recovery time, whatever the plan document says.

✅ Checkpoint: saat-daily picks up servers tagged Backup=daily, an on-demand backup reached COMPLETED, and the restored server in ap-south-1b shows both order lines. Keep it all for the break lab.

Break It, Then Fix It

Here are two problems that show up at the worst possible time, one during a restore and one during cleanup.

1Break it: restore without iam:PassRole

Take the PassRole policy away and restore again:

aws iam delete-role-policy --role-name saat-backup-role --policy-name pass-instance-role
Start-Sleep 10
$rj2 = aws backup start-restore-job --recovery-point-arn $rp --iam-role-arn $role --metadata file://restore-meta.json --resource-type EC2 --query RestoreJobId --output text
do { Start-Sleep 20; $st = aws backup describe-restore-job --restore-job-id $rj2 --query Status --output text } until ($st -in 'COMPLETED', 'FAILED', 'ABORTED')
$msg = aws backup describe-restore-job --restore-job-id $rj2 --query StatusMessage --output text
"$st $($msg.Substring(0, [Math]::Min(100, $msg.Length)))"

You should see something like this:

FAILED You are not authorized to perform this operation. Encoded authorization failure message: cqfTYjk8Ynp2c
AWS Backup problems: restore fails on iam:PassRole, vault with recovery points
Both problems and their fixes. Something like this.

The reason is hidden inside an encoded string in the message, so decode it to see which permission was missing:

$enc = $msg -replace '.*failure message: ', ''
$dm = aws sts decode-authorization-message --encoded-message $enc --query DecodedMessage --output text | ConvertFrom-Json
"$($dm.context.action) on $($dm.context.resource)"

You should see something like this:

iam:PassRole on arn:aws:iam::111122223333:role/saat-ec2-ssm-role

AWS Backup’s managed restore policy deliberately won’t let it hand your instance role to a new server, to stop privilege escalation, and most teams only find this out during their first real incident. Fix: grant PassRole on only the instance roles you restore with (or restore without a profile), and test your restores before you need them:

aws iam put-role-policy --role-name saat-backup-role --policy-name pass-instance-role --policy-document file://passrole.json

2Break it: delete a vault that still holds backups

Try deleting saat-vault:

aws backup delete-backup-vault --backup-vault-name saat-vault

You’ll get an error like this:

An error occurred (InvalidRequestException) when calling the DeleteBackupVault operation: Backup vault cannot be deleted because it contains recovery points.

This is a safety net: you can’t remove a vault while it still holds recovery points, and with Vault Lock in compliance mode even deleting the recovery points is refused until their retention runs out. Fix: delete the recovery points first (for EC2 that also removes the AMI and snapshots), and then the vault, plan and role:

aws backup list-recovery-points-by-backup-vault --backup-vault-name saat-vault --query "RecoveryPoints[].RecoveryPointArn" --output text | ForEach-Object { $_ -split '\s+' } | Where-Object { $_ } | ForEach-Object { aws backup delete-recovery-point --backup-vault-name saat-vault --recovery-point-arn $_ }
do { Start-Sleep 20; $n = aws backup list-recovery-points-by-backup-vault --backup-vault-name saat-vault --query "length(RecoveryPoints)" --output text } until ($n -eq '0')
aws backup delete-backup-selection --backup-plan-id $plan --selection-id $sel
aws backup delete-backup-plan --backup-plan-id $plan | Out-Null
aws backup delete-backup-vault --backup-vault-name saat-vault
aws ec2 terminate-instances --instance-ids $i $restored | Out-Null
aws ec2 wait instance-terminated --instance-ids $i $restored
aws iam delete-role-policy --role-name saat-backup-role --policy-name pass-instance-role
aws iam detach-role-policy --role-name saat-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup
aws iam detach-role-policy --role-name saat-backup-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForRestores
aws iam delete-role --role-name saat-backup-role
.\Stop-SsmEndpoints.ps1
Remove-Item backup-*.json, passrole.json, restore-meta.json, bk-userdata.sh
.\Find-LabResources.ps1

✅ Checkpoint: You decoded a failed restore down to iam:PassRole and fixed it, and you emptied a vault before deleting it. The plan, vault, recovery points, role and both servers are gone.

This happened at work

The backups that had never been restored

A manufacturing company had been running nightly AWS Backup jobs for its ERP servers for two years, every one of them green. Then ransomware encrypted the application volumes, and at 9 a.m., with the whole company waiting, the team started a restore. The first attempt failed on iam:PassRole. The second came up in a subnet with no route to the database. The third one worked, but the app needed a license file that lived on a second volume, added later and never tagged for backup. In the end the ERP came back the next afternoon when it should have taken two hours. These days they run AWS Backup restore testing every week for each critical app, with a validation script that checks the app responds and the key files are there, they copy backups to a separate account with Vault Lock, and they select resources by application tag so new volumes are covered automatically.

Common mistakes and troubleshooting

MistakeWhat happensWhat to do
Never testing restoresFailures found during the real incidentScheduled restore tests with validation
Restoring with an instance profile, no PassRoleRestore FAILED: not authorizedGrant iam:PassRole on the instance role
Selecting resources by IDNew volumes and servers are missedSelect by tag and enforce the tag
Backups only in the same accountAn attacker with admin deletes them tooCopy to another account; use Vault Lock
Plan schedule in UTC without thinkingBackups run during business hoursConvert times, or set the schedule time zone
Deleting vaults or plans in the wrong orderErrors and leftover snapshotsRecovery points first, then selection, plan and vault

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and under it you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. Can you explain in simple words what AWS Backup is and why a team would use it?

Why they ask this: Every admin is responsible for backups, so they want to know you understand how they’re managed in AWS.

How you might answer: It’s a managed service that brings backups for lots of services into one place, like EC2, EBS, RDS, EFS, DynamoDB and S3, and you control it with backup plans, vaults and policies. Without it every team sets up snapshots its own way, and it’s hard to tell what’s protected and what isn’t.

2. What is a backup vault, and what would you set on one?

Why they ask this: They’re checking you know where recovery points live and how they’re protected, which matters a lot when someone tries to delete backups.

How you might answer: A backup vault is a container for recovery points, encrypted with a KMS key and with its own access policy. I can also switch on Vault Lock, which stops anyone deleting recovery points before their retention ends.

3. Developers keep launching new servers and forgetting to add them to backups. How would you fix that?

Why they ask this: Forgotten servers are one of the most common gaps, so they want to see you’d design backups that don’t rely on people remembering.

How you might answer: I’d use a tag-based selection in the backup plan, for example Backup=daily, so any resource with that tag is backed up. Then I’d make sure new servers get the tag automatically through launch templates or tag policies.

2–5 years experience

4. You try to restore an EC2 instance from AWS Backup and it fails with “not authorized”. What would you check?

Why they ask this: Restores usually happen in the middle of an incident, so they want to see you can troubleshoot one under pressure and know the common causes.

How you might answer: I’d decode the authorization message first to see which action was denied. Usually it’s a missing iam:PassRole for the instance profile role, or missing KMS key permissions for encrypted snapshots, and I’d also check the restore role is allowed to use the target subnet and security group.

5. How would you explain RPO and RTO to a business manager, and where does AWS Backup fit in?

Why they ask this: They want to know you can talk about recovery in business terms, and that you understand a plan on paper doesn’t prove anything.

How you might answer: I’d say RPO is how much data we can afford to lose, which depends on how often we back up, so with daily backups we could lose up to 24 hours. RTO is how long it takes to get things running again, and I’d make the point that the only real RTO is the one we measure in restore tests, not the one written in the plan.

6. Your security team is worried that ransomware could delete your backups too. How would you protect them?

Why they ask this: Backups are only useful if they survive the attack, so they want to see you think about attackers who already have access to the account.

How you might answer: I’d copy backups to a separate account and turn on Vault Lock in compliance mode so nobody can delete them early, with separate KMS keys and strict vault access policies. On top of that I’d add SCPs that block backup deletion and set up alerts for any deletion attempt.

Senior level

7. You’re asked to design backup and recovery for 200 servers and 30 databases. How would you approach it?

Why they ask this: They want a design that covers policy, isolation, consistency and testing, and that’s about recovery and not only about taking backups.

How you might answer: I’d use organization backup policies by tag tier, say daily kept for 35 days and monthly kept for 1 year, with backups copied to a central backup account and another Region and Vault Lock on. For the databases I’d use application-consistent backups, and I’d run restore testing for each tier with validation and put job failures on a dashboard.

8. An auditor asks you to prove your backups actually work. What would you show them?

Why they ask this: Auditors want proof that recovery is possible, so they want to see you’d bring real evidence and not just say the backups are running.

How you might answer: I’d show them AWS Backup Audit Manager frameworks and reports, restore testing results with timestamps and validation status, and our job success rates. The thing I’d put in front of them most, though, is the RTO numbers we measured in real restore tests, so they can see how long recovery takes.

Quick quiz

Q1. What decides which resources a backup plan protects?

  1. The vault
  2. The selection, for example by tag
  3. The KMS key
  4. The schedule
Show answer

B — Selections pick resources by tag or ARN.

Q2. Why did the second restore fail?

  1. The vault was locked
  2. The Backup role lacked iam:PassRole for the instance role
  3. The snapshot was deleted
  4. The subnet was wrong
Show answer

B — Restoring with an instance profile needs PassRole.

Q3. What does a restore create?

  1. It overwrites the original
  2. A new resource from the recovery point
  3. Only a snapshot
  4. Nothing
Show answer

B — Restores create new resources.

Q4. Why can’t you delete a vault with recovery points?

  1. Vaults can’t be deleted
  2. It protects backups from accidental deletion
  3. The plan is attached
  4. The KMS key is in use
Show answer

B — Delete recovery points first.

Q5. What is the best proof that backups work?

  1. Green job status
  2. A tested restore with validated data
  3. A large backup size
  4. A long retention
Show answer

B — Only a restore proves recoverability.

Quick recap

  • A backup plan has rules for the schedule, lifecycle and copies, and a selection picks the resources by tag.
  • Recovery points live in a vault encrypted with KMS, which you can also lock.
  • Restores create new resources, and restoring with an instance profile needs iam:PassRole.
  • Test your restores and measure the real recovery time.
  • Delete recovery points before the vault, and copy backups to another account to keep them safe.

Next lesson

Lesson 30: KMS encryption keys → Next you’ll create customer managed keys, decide who can use them through key policies, and find out what happens when a key gets disabled.

Further reading: AWS Backup plan

Want to go deeper into AWS Backup plan? Read Backup plans and Restore an Amazon EC2 instance. You can also see the full plan for this course on the AWS Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.