Last active
January 31, 2021 20:02
-
-
Save hatchcanon/f26be69737e5fd0d1a316dc6dc58efa7 to your computer and use it in GitHub Desktop.
Removes all recovery points from a specific time frame inside a AWS Backup vault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VAULT_NAME="" | |
echo "Enter the name of the vault where all backups should be deleted" | |
read -t 10 VAULT_NAME || exit | |
# be sure to change the by-created-before and by-created-after to your liking | |
for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "${VAULT_NAME}" --by-created-before "2021-01-28T21:28:00/-0600" --by-created-after "2021-01-28T21:26:00/-0600" --query 'RecoveryPoints[].RecoveryPointArn' --output text --region us-east-1); do | |
echo "deleting ${ARN} ..." | |
aws backup delete-recovery-point --region us-east-1 --backup-vault-name "${VAULT_NAME}" --recovery-point-arn "${ARN}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment