阿里云在哪里保存可用区的完整列表?

Where does Ali Cloud keep a full list of availability zones?

阿里云的区域帮助页面为您提供了完整的区域列表。这很有帮助。他们告诉您每个地区有多少可用区也很有帮助。

没有帮助的是他们未能列出每个可用性区域的名称。二十分钟的谷歌搜索时间太长了,不能花在这上面。阿里云可用区的完整列表在哪里?

在撰写本文时,似乎没有一个易于访问的阿里云所有可用区域列表。要获得完整列表,您需要使用 Ali Cloud CLI tool.

将其下拉

它会吐出一堵 JSON 的墙,所以在 *nix 上并有可用的 jq tool 也很有帮助。

考虑到所有这些,您只需要这个简短的 shell 脚本:

#!/usr/bin/env bash

for region in $( aliyun ecs DescribeRegions | jq '.Regions.Region[].RegionId' )
do
    echo $region
    reg=$( echo $region | sed s/\"//g )
    echo '---'
    for zone in $( aliyun ecs DescribeZones --RegionId $reg | jq '.Zones.Zone[].ZoneId' | sort )
    do
        echo $zone
    done
    echo ''
done

输出结果如下

"cn-qingdao"
---
"cn-qingdao-b"
"cn-qingdao-c"

"cn-beijing"
---
"cn-beijing-a"
"cn-beijing-b"
"cn-beijing-c"
"cn-beijing-d"
"cn-beijing-e"
"cn-beijing-f"
"cn-beijing-g"

"cn-zhangjiakou"
---
"cn-zhangjiakou-a"
"cn-zhangjiakou-b"

"cn-huhehaote"
---
"cn-huhehaote-a"
"cn-huhehaote-b"

"cn-hangzhou"
---
"cn-hangzhou-b"
"cn-hangzhou-c"
"cn-hangzhou-d"
"cn-hangzhou-e"
"cn-hangzhou-f"
"cn-hangzhou-g"
"cn-hangzhou-h"

"cn-shanghai"
---
"cn-shanghai-a"
"cn-shanghai-b"
"cn-shanghai-c"
"cn-shanghai-d"
"cn-shanghai-e"
"cn-shanghai-f"

"cn-shenzhen"
---
"cn-shenzhen-a"
"cn-shenzhen-b"
"cn-shenzhen-c"
"cn-shenzhen-d"

"cn-hongkong"
---
"cn-hongkong-a"
"cn-hongkong-b"
"cn-hongkong-c"

"ap-northeast-1"
---
"ap-northeast-1a"

"ap-southeast-1"
---
"ap-southeast-1a"
"ap-southeast-1b"
"ap-southeast-1c"

"ap-southeast-2"
---
"ap-southeast-2a"
"ap-southeast-2b"

"ap-southeast-3"
---
"ap-southeast-3a"
"ap-southeast-3b"

"ap-southeast-5"
---
"ap-southeast-5a"

"ap-south-1"
---
"ap-south-1a"
"ap-south-1b"

"us-east-1"
---
"us-east-1a"
"us-east-1b"

"us-west-1"
---
"us-west-1a"
"us-west-1b"

"eu-west-1"
---
"eu-west-1a"
"eu-west-1b"

"me-east-1"
---
"me-east-1a"

"eu-central-1"
---
"eu-central-1a"
"eu-central-1b"

阿里巴巴云在其网站上确实有关于 "No. of available zones under each region and services available in that particular region" 的详细信息。请看一下 Alibaba Cloud Website.