Skip to content

Instantly share code, notes, and snippets.

@ScriptAutomate
Created August 13, 2019 10:57
Show Gist options
  • Save ScriptAutomate/f39fb083243193bbc5fe013db744b589 to your computer and use it in GitHub Desktop.
Save ScriptAutomate/f39fb083243193bbc5fe013db744b589 to your computer and use it in GitHub Desktop.
List All AWS Regions via AWS EC2 API (PreReq: Need AWSCLI / Credentials Configured)
from boto3 import client
def gather_aws_regions():
'''Return all available AWS Regions via EC2 api'''
conn = client('ec2')
regions = conn.describe_regions(AllRegions=True)['Regions']
return [region['RegionName'] for region in regions]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment