Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sean-smith
Last active February 14, 2023 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sean-smith/f28666f384a520b644c80552fe13daf6 to your computer and use it in GitHub Desktop.
Save sean-smith/f28666f384a520b644c80552fe13daf6 to your computer and use it in GitHub Desktop.
BE CAREFUL. This removes buckets with the prefix you specify.
#!/bin/bash
# Usage: bash remove-bucket.sh bucket1
for bucket in $(aws s3 ls | grep $1 | awk '{ print $3}'); do
echo "Deleting ${bucket}..."
aws s3 rm --recursive s3://${bucket};
aws s3 rb --force s3://${bucket};
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment