I tried accessing the AWS Price List API using the Singapore region (ap-southeast-1) but it resulted the error
Could not connect to the endpoint URL: "https://api.pricing.ap-southeast-1.amazonaws.com/".
But whenever I use the N. Virginia Region (us-east-1) it works without any issues.
Continue reading What regions will the AWS Price List API work?
If you want to programmatically retrieve the AWS regions one of the best ways to do this is via Python boto3 package.
In boto3, specifically the EC2 client, there is a function named
describe_regions. This will retrieve the regions that are in AWS.
See different uses of the
describe_regions function below.
Basic code for retrieving the AWS Regions using boto3
Here is a basic code for getting the AWS Regions in boto3.
ec2_client = boto3.client('ec2')
response = ec2_client.describe_regions()
response is a dictionary that contains all active regions in the AWS Account.
The output of the Python script above can be seen below. I decided to format the output for easier reading, and show the whole
Continue reading Listing AWS Regions using boto3 Python
response to easily understand how to manipulate the output.