How do I get a list of Amazon regions via the command line?
I'd like to see how I can get a list of regions from AWS on the command line so I can quickly look things up, how can I do this?
Solution 1:
This is now how you'd do it using the aws cli:
$ aws ec2 describe-regions --output table
----------------------------------------------------------
| DescribeRegions |
+--------------------------------------------------------+
|| Regions ||
|+-----------------------------------+------------------+|
|| Endpoint | RegionName ||
|+-----------------------------------+------------------+|
|| ec2.eu-west-1.amazonaws.com | eu-west-1 ||
|| ec2.ap-southeast-1.amazonaws.com | ap-southeast-1 ||
|| ec2.ap-southeast-2.amazonaws.com | ap-southeast-2 ||
|| ec2.eu-central-1.amazonaws.com | eu-central-1 ||
|| ec2.ap-northeast-2.amazonaws.com | ap-northeast-2 ||
|| ec2.ap-northeast-1.amazonaws.com | ap-northeast-1 ||
|| ec2.us-east-1.amazonaws.com | us-east-1 ||
|| ec2.sa-east-1.amazonaws.com | sa-east-1 ||
|| ec2.us-west-1.amazonaws.com | us-west-1 ||
|| ec2.us-west-2.amazonaws.com | us-west-2 ||
|+-----------------------------------+------------------+|
Solution 2:
You can do this by running the command ec2-describe-regions from the command line (if you have ec2-api-tools installed available in multiverse).
$ ec2-describe-regions
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com