How to remove the AWS Backups 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?
Coincidentally I had to do something very similar yesterday. This is the script I used:
#!/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 &quot;${​​​​​​​VAULT_NAME}​​​​​​​&quot; --query 'RecoveryPoints[].RecoveryPointArn' --output text); do
  echo &quot;deleting ${​​​​​​​ARN}​​​​​​​ ...&quot;
  aws backup delete-recovery-point --backup-vault-name &quot;${​​​​​​​VAULT_NAME}​​​​​​​&quot; --recovery-point-arn &quot;${​​​​​​​ARN}​​​​​​​&quot;
done

You can also add --by-created-before to delete the old backups only.
Hope that helps :)