Snippet - Delete all S3 buckets with a single command

A really fast way to delete all your S3 buckets using the aws-cli

Contents

Deleting S3 buckets can be a painful multistep process. Buckets need to be emptied out before they can be removed with several captchas in place to avoid accidental deletes. aws-cli can be used to do this quickly.

The command will delete ALL S3 buckets. Use carefully
aws s3 ls | awk '{print $3}' | xargs -n1 -I{} aws s3 rb s3://{} --force

Command output

Join my newsletter
I'll send you my latest blog posts by email. Also, you'll be the first to hear about new things I'm working on.