Sub topic 2
Backup vaults: where recovery points are stored
This chapter assumes you can use the AWS CLI, understand IAM policies, and know what a recovery point is at a high level. A recovery point is one backup of one resource at one moment. Here you will learn what a vault is, how it is scoped, and how to create, inspect, restrict and delete one.
What a vault is
A backup vault is a named container in one AWS account and one Region. Every recovery point that AWS Backup creates lands in exactly one vault. The vault is also the place where you attach several controls:
- the KMS key used to encrypt the vault's contents
- an access policy that says who may do what to the recovery points
- notification settings that publish job events to Amazon SNS
- Vault Lock, which makes the vault's retention rules hard to change (covered in a later chapter)
A vault is not a storage bucket you read from directly. You cannot list objects in it or mount it. You interact with it through the AWS Backup API, and you restore from it by creating a new resource.
Scope and naming rules
- A vault exists in one Region of one account. A plan in
us-east-1cannot write to a vault ineu-west-1. To get a copy elsewhere, you use a copy action, which is a separate topic. - The name must be unique within the account and Region. It can be 2 to 50 characters, using letters, numbers, hyphens and underscores.
- The name cannot be changed after creation. If you need a different name, you create a new vault and copy recovery points into it.
- Each account and Region has a
Defaultvault that AWS Backup creates for you when you first use the service. It uses the AWS managed key. Many teams avoid it for real workloads because it is shared by everything that does not name another vault.
A recovery point cannot move between vaults. The only way to "move" one is to copy it to the target vault and delete the original.
Vaults as a boundary
Because policy, encryption and lock settings all attach to the vault, the vault is your unit of separation. A common layout is one vault per combination of sensitivity and retention need, not one vault per application.
| Design choice | Benefit | Cost |
|---|---|---|
| One vault for everything | Simple to manage | One policy and one key for all data. A single mistake affects every backup. |
| Vault per environment (prod, dev) | Production backups get stricter policies and a separate key | A few more vaults to track |
| Vault per team or application | Fine-grained access and billing clarity | Many vaults, and more plan rules to maintain |
| Separate vault in another account | Protection if the source account is compromised | Needs cross-account copy and permissions |
Rules in a backup plan name a target vault, so the vault must exist before the plan can be created.
Creating a vault
The minimum command takes only a name.
aws backup create-backup-vault \
--backup-vault-name app-vault
aws backup list-backup-vaultsIf you leave out --encryption-key-arn, AWS Backup uses the AWS managed key aws/backup. To use a customer managed key, and to add tags, pass them at creation time. The key must be in the same Region as the vault.
aws backup create-backup-vault \
--backup-vault-name prod-vault \
--encryption-key-arn arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab \
--backup-vault-tags Environment=prod,Owner=platformThe encryption key cannot be changed on an existing vault. Choose it before you create the vault. The next chapter covers how to choose it.
Inspecting a vault
describe-backup-vault returns the vault's ARN, its key, the number of recovery points, and whether it is locked.
aws backup describe-backup-vault \
--backup-vault-name prod-vaultCheck these fields in the output:
EncryptionKeyArnshows which key protects the vault.NumberOfRecoveryPointstells you whether the vault is empty. A vault must be empty before you can delete it.Lockedistrueonce Vault Lock has been configured.
Controlling access with a vault access policy
A vault access policy is a resource-based IAM policy attached to the vault. It is evaluated together with the identity policies of the caller. An explicit deny in the vault policy wins over an allow anywhere else, which makes it a good tool for protecting recovery points from deletion.
This policy denies backup:DeleteRecoveryPoint to everyone except one administrative role.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyDeleteExceptBackupAdmin",
"Effect": "Deny",
"Principal": "*",
"Action": "backup:DeleteRecoveryPoint",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:PrincipalArn": "arn:aws:iam::123456789012:role/BackupAdmin"
}
}
}
]
}Save it as vault-policy.json and attach it:
aws backup put-backup-vault-access-policy \
--backup-vault-name prod-vault \
--policy file://vault-policy.json
aws backup get-backup-vault-access-policy \
--backup-vault-name prod-vaultNotifications
A vault can publish events to an SNS topic, so you learn about failed jobs without polling. You choose the events you want per vault.
aws backup put-backup-vault-notifications \
--backup-vault-name prod-vault \
--sns-topic-arn arn:aws:sns:us-east-1:123456789012:backup-events \
--backup-vault-events BACKUP_JOB_COMPLETED RESTORE_JOB_COMPLETEDThe SNS topic's access policy must allow AWS Backup to publish to it. If it does not, the command may succeed but you will receive no messages. Monitoring is covered in more depth in a later chapter.
Deleting a vault and common errors
You can delete a vault only when it holds no recovery points. First list and delete the recovery points, then delete the vault.
aws backup list-recovery-points-by-backup-vault \
--backup-vault-name prod-vault
aws backup delete-recovery-point \
--backup-vault-name prod-vault \
--recovery-point-arn <recovery-point-arn>
aws backup delete-backup-vault \
--backup-vault-name prod-vaultThese are the errors you are most likely to meet:
- Name already exists. Vault names are unique per account and Region. Listing vaults in the Region shows what is taken.
- Key not found or not accessible. The KMS key is in another Region, is disabled, or its key policy does not let you use it. Fix the key, then retry.
- Vault is not empty on delete. Delete the recovery points first. Remember that recovery points kept by a lifecycle rule are removed on their own schedule, not on demand.
- Cannot delete a recovery point. An access policy deny, or Vault Lock retention, is blocking you. A locked vault enforces its minimum retention even for administrators.
- Wrong Region.
list-backup-vaultsshows only the Region in your CLI configuration. If a vault seems missing, pass--region.
Key points
- A vault holds recovery points for one account in one Region.
- Name and key are fixed at creation. Policy and notifications can be changed later.
- Use vaults to separate data that needs different keys, access rules or retention.
- A deny in the vault policy is a strong guard. Vault Lock is the stronger one.
Exercise
Your team has production and development workloads in us-east-1. You want only a small group of people to be able to delete production recovery points, and you want production backups encrypted with a customer managed key. How many vaults do you need at minimum, what must you decide before creating them, and which vault setting do you use to restrict deletion?
Show answer
At minimum two vaults: one for production and one for development. Before creating the production vault you must choose its KMS key (a customer managed key in us-east-1), because the key cannot be changed afterward. Restrict deletion with a vault access policy that denies backup:DeleteRecoveryPoint to everyone except the permitted role. Use Vault Lock if you also need the restriction to be impossible to remove.
Exercise
You run aws backup delete-backup-vault --backup-vault-name old-vault and it fails. Which field from describe-backup-vault do you check first, and what is the next step if it is not zero?
Show answer
Check NumberOfRecoveryPoints. If it is not zero, list the recovery points with list-recovery-points-by-backup-vault and delete each one with delete-recovery-point, then run delete-backup-vault again. If a delete is refused, check for a deny in the vault access policy or for Vault Lock retention.