Skip to content

Instantly share code, notes, and snippets.

@pahud
Created August 18, 2019 04:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahud/da51299b77a30434f440d821930badce to your computer and use it in GitHub Desktop.
Save pahud/da51299b77a30434f440d821930badce to your computer and use it in GitHub Desktop.
list s3 bucket names starting with a prefix
# 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
@nguni52
Copy link

nguni52 commented Jul 18, 2022

This just came in handy. I had way too many buckets and had to find a way to remove them quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment