Created
August 18, 2019 04:39
-
-
Save pahud/da51299b77a30434f440d821930badce to your computer and use it in GitHub Desktop.
list s3 bucket names starting with a prefix
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
# list buckets starting with 'codebuild' | |
buckets=($(aws s3api list-buckets --query 'Buckets[?starts_with(Name, `codepipeline-`) == `true`].Name' --output text)) | |
# delete them | |
for b in ${buckets[@]} | |
do | |
aws s3 rb --force s3://${b} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This just came in handy. I had way too many buckets and had to find a way to remove them quickly!