Skip to content

Instantly share code, notes, and snippets.

@ereli
Created April 15, 2021 02:33
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 ereli/467a088b746d4d2067a844fa5ebde5d9 to your computer and use it in GitHub Desktop.
Save ereli/467a088b746d4d2067a844fa5ebde5d9 to your computer and use it in GitHub Desktop.
Enumerate all VPCs you have on all AWS regions
for region in af-south-1 ap-east-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 cn-north-1 cn-northwest-1 eu-central-1 eu-north-1 eu-south-1 eu-west-1 eu-west-2 eu-west-3 me-south-1 sa-east-1 us-east-1 us-east-2 us-gov-east-1 us-gov-west-1 us-west-1 us-west-2
echo $region
aws ec2 describe-vpcs --region $region |jq '.Vpcs[]|[.VpcId, .CidrBlock, (.Tags[]|select(.Key=="Name")).Value]|@csv' -rc 2>/dev/null
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment