使用describe-regions命令描述您的账户的区域
下面是通过账户访问所有AWS区域列表
[centos@ip-172-31-48-15 ~]$ aws ec2 describe-regions
REGIONS ec2.ap-south-1.amazonaws.com ap-south-1
REGIONS ec2.eu-west-3.amazonaws.com eu-west-3
REGIONS ec2.eu-west-2.amazonaws.com eu-west-2
REGIONS ec2.eu-west-1.amazonaws.com eu-west-1
REGIONS ec2.ap-northeast-2.amazonaws.com ap-northeast-2
REGIONS ec2.ap-northeast-1.amazonaws.com ap-northeast-1
REGIONS ec2.sa-east-1.amazonaws.com sa-east-1
REGIONS ec2.ca-central-1.amazonaws.com ca-central-1
REGIONS ec2.ap-southeast-1.amazonaws.com ap-southeast-1
REGIONS ec2.ap-southeast-2.amazonaws.com ap-southeast-2
REGIONS ec2.eu-central-1.amazonaws.com eu-central-1
REGIONS ec2.us-east-1.amazonaws.com us-east-1
REGIONS ec2.us-east-2.amazonaws.com us-east-2
REGIONS ec2.us-west-1.amazonaws.com us-west-1
REGIONS ec2.us-west-2.amazonaws.com us-west-2
使用describe-availability-zones命令描述指定区域内的可用区
下面是访问us-east-1区域内的可用区列表
[centos@ip-172-31-48-15 ~]$ aws ec2 describe-availability-zones --region us-east-1
AVAILABILITYZONES us-east-1 available us-east-1a
AVAILABILITYZONES us-east-1 available us-east-1b
AVAILABILITYZONES us-east-1 available us-east-1c
AVAILABILITYZONES us-east-1 available us-east-1d
AVAILABILITYZONES us-east-1 available us-east-1e
AVAILABILITYZONES us-east-1 available us-east-1f
使用环境变量设置默认可用区
在AWS CLI方式中,设置环境变量AWS_DEFAULT_REGION
来指定默认可用区,这里我指定us-east-2为我的默认AWS区域。
[centos@ip-172-31-48-15 ~]$ aws ec2 describe-availability-zones
AVAILABILITYZONES us-east-2 available us-east-2a
AVAILABILITYZONES us-east-2 available us-east-2b
AVAILABILITYZONES us-east-2 available us-east-2c