Created
August 13, 2019 10:57
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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