Created
December 28, 2022 18:13
-
-
Save pshirshov/d6b1c7801aaf00320dc8a3f57c79f327 to your computer and use it in GitHub Desktop.
s3 mass bucket removal
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
#!/usr/bin/env bash | |
set -x | |
set -e | |
PREFIX=$1 | |
buckets=$(aws s3api list-buckets | jq -r '.Buckets | map(.Name) | .[] | select(. | startswith("'${PREFIX}'-"))') | |
for bucket in $buckets; do | |
aws s3 rb s3://$bucket --force | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment