Created
September 20, 2021 19:20
-
-
Save jchrisfarris/d99fc85123c8e6d7942c2d2119c79706 to your computer and use it in GitHub Desktop.
Delete all recovery points and Vaults
This file contains hidden or 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 | |
REGIONS=`aws ec2 describe-regions --query Regions[].RegionName --output text` | |
for r in $REGIONS ; do | |
VAULTS=`aws backup list-backup-vaults --query BackupVaultList[].BackupVaultName --output text --region $r` | |
for v in $VAULTS ; do | |
RECOVERY_POINTS=`aws backup list-recovery-points-by-backup-vault --backup-vault-name $v --query RecoveryPoints[].RecoveryPointArn --output text --region $r` | |
for a in $RECOVERY_POINTS ; do | |
echo "Deleting RecoveryPoint $a from $v" | |
aws backup delete-recovery-point --backup-vault-name $v --recovery-point-arn $a --region $r | |
done | |
echo "Deleting Vault $v in $r" | |
aws backup delete-backup-vault --backup-vault-name $v --region $r | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment