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}" |