snippetMinor
How to remove the AWS Backups
Viewed 0 times
thebackupsremoveawshow
Problem
I'm using AWS Backup to create snapshots of my production server. My current backup plan has infinite retention and that ran me into gigabytes of storage.
What would be the best way to fix that? I saw I can't remove the backups in bulk (can only select and remove each single backup, but I have 100s).
Is it possible to modify the backup rule so that it removes the previous backups? Or is there a way to select and remove all the backups done by AWS Backup?
What would be the best way to fix that? I saw I can't remove the backups in bulk (can only select and remove each single backup, but I have 100s).
Is it possible to modify the backup rule so that it removes the previous backups? Or is there a way to select and remove all the backups done by AWS Backup?
Solution
Coincidentally I had to do something very similar yesterday. This is the script I used:
You can also add
Hope that helps :)
#!/bin/bash -e
VAULT_NAME=... # put your Backup Vault name here
for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "${VAULT_NAME}" --query 'RecoveryPoints[].RecoveryPointArn' --output text); do
echo "deleting ${ARN} ..."
aws backup delete-recovery-point --backup-vault-name "${VAULT_NAME}" --recovery-point-arn "${ARN}"
done
You can also add
--by-created-before to delete the old backups only.Hope that helps :)
Context
StackExchange DevOps Q#12842, answer score: 2
Revisions (0)
No revisions yet.