Skip to content

Instantly share code, notes, and snippets.

@ap1kenobi
Last active November 5, 2020 23:51
Show Gist options
  • Save ap1kenobi/d2d7986d39f0ca1ff177bba154984b83 to your computer and use it in GitHub Desktop.
Save ap1kenobi/d2d7986d39f0ca1ff177bba154984b83 to your computer and use it in GitHub Desktop.
Removes all backups (aka recovery points) inside a AWS Backup vault
#!/bin/bash
set -e
echo "Enter the region of the vault where all backups should be deleted"
read REGION
echo "Enter the name of the vault where all backups should be deleted"
read VAULT_NAME
for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "${VAULT_NAME}" --query 'RecoveryPoints[].RecoveryPointArn' --output text --region "${REGION}"); do
echo "deleting ${ARN} ..."
aws backup delete-recovery-point --backup-vault-name "${VAULT_NAME}" --recovery-point-arn "${ARN}" --region "${REGION}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment