Skip to content

Instantly share code, notes, and snippets.

@srkiNZ84
Created October 17, 2023 01:55
Show Gist options
  • Save srkiNZ84/f4ad8bee7a0759bada85de7013373feb to your computer and use it in GitHub Desktop.
Save srkiNZ84/f4ad8bee7a0759bada85de7013373feb to your computer and use it in GitHub Desktop.
Bash script to delete all AWS backup recovery points in a vault
#!/bin/bash
# Run:
# aws backup list-recovery-points-by-backup-vault --backup-vault-name aft-controltower-backup-vault | jq --raw-output ".RecoveryPoints[].RecoveryPointArn" > /tmp/aft_recovery_point_arns.txt
# first to get the list of recovery points to delete. Then run this script with the filename as the argument
# e.g.
# aft_delete_recovery_points.sh /tmp/aft_recovery_point_arns.txt
while read -r line; do
echo "deleting recovery point: $line"
aws backup delete-recovery-point --backup-vault-name aft-controltower-backup-vault --recovery-point-arn "$line"
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment