AWS cli cheat sheet

List of code tidbits

This page has a random list of code tidbits or bash command line tricks to do stuff with AWS.

List all regions

aws ec2 describe-regions | jq '.Regions|to_entries[]|.value.RegionName' -r

This is useful if you want to then look for stuff in all regions like this:

for region in $(aws ec2 describe-regions | jq '.Regions|to_entries[]|.value.RegionName' -r); do 
    echo $region; aws ec2 describe-vpcs --region $region
done

Recursively Delete Buckets

This isn’t really needed because the AWS Console has a delete bucket button that does all of this for you in a click. But here it is anyway.

delete_buckets.sh

Leave a Comment