web-dev-qa-db-fra.com

Comment obtenir une liste des régions Amazon via la ligne de commande?

J'aimerais voir comment je peux obtenir une liste de régions d'AWS en ligne de commande afin de pouvoir effectuer rapidement des recherches, comment puis-je procéder?

12
Jorge Castro

Vous pouvez le faire en exécutant la commande ec2-describe-regions à partir de la ligne de commande (si vous avez installé ec2-api-tools dans multivers).

$ 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
9
lynxman

Voici comment vous le feriez avec la clé aws:

$ 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       ||
|+-----------------------------------+------------------+|
9
slm