alibaba-cloud

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


Alibaba Cloud's help page for regions gives you the full list of regions. That is helpful. It is also helpful that they tell you how many availability zones are in each region.

What is NOT helpful is that they fail to list the names of each availability zone. Twenty minutes of googling is way too long to spend on this. Where is the full list of availability zones for Ali Cloud/ Aliyun?


Solution

  • As of this writing there does not seem to be an easily accessible list of all availability zones by region for Aliyun. To get the full list you will need to pull it down with their Ali Cloud CLI tool.

    It will spit out a wall of JSON, so it is also helpful to be on *nix and have the jq tool available.

    Given all that, all you need is this short shell script:

    #!/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
    

    The output of which is as follows.

    "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"