Skip to content

Instantly share code, notes, and snippets.

@mikegrima
Created June 27, 2022 16:41
Show Gist options
  • Save mikegrima/667e226686fdffd8d8822f771cc17a6c to your computer and use it in GitHub Desktop.
Save mikegrima/667e226686fdffd8d8822f771cc17a6c to your computer and use it in GitHub Desktop.
Get the available regions for a given AWS service
# Get the available regions for a given AWS serivce:
# As seen on: https://github.com/boto/boto3/issues/188
import boto3
print(boto3.session.Session().get_available_regions('sns'))
# ['af-south-1', 'ap-east-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-southeast-3', 'ca-central-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-west-1', 'us-west-2']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment