Help Center/ MapReduce Service/ API Reference/ API V1.1/ Availability Zones/ Querying AZ Information - ListAvailableZones
Updated on 2026-09-15 GMT+08:00

Querying AZ Information - ListAvailableZones

Function

This API is used to query the available zone (AZ) information in the current region of the MRS service, including the AZ ID and name. When creating a cluster, you need to use this API to obtain the AZ ID to configure the location of the cluster nodes.

Constraints

None

Debugging

You can debug this API in API Explorer. Automatic authentication is supported. API Explorer can automatically generate sample SDK code and supports sample SDK code debugging.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permissions are required for calling this API.

URI

GET /v1.1/{region_id}/available-zones

Table 1 URI parameters

Parameter

Mandatory

Type

Description

region_id

Yes

String

Definition

Region ID.

Constraints

N/A

Range

The value can contain 1 to 255 characters. Only lowercase letters, digits, and hyphens (-) are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

scope

No

String

Definition

AZ scope.

Constraints

N/A

Range

  • Center: central AZ
  • Edge: edge AZ

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameter

Parameter

Type

Description

available_zones

Array of AvailableZoneV2 objects

Definition

AZ list.

Range

N/A

default_az_code

String

Definition

Default AZ code

Range

N/A

support_physical_az_group

Boolean

Definition

Whether physical AZ group is supported.

Range

  • True: Physical availability groups are supported.
  • False: Physical availability groups are not supported.
Table 4 AvailableZoneV2

Parameter

Type

Description

id

String

Definition

Unique ID of an AZ.

Range

N/A

az_code

String

Definition

AZ code.

Range

N/A

az_name

String

Definition

AZ name.

Range

N/A

az_id

String

Definition

AZ ID.

Range

N/A

status

String

Definition

AZ status

Range

N/A

region_id

String

Definition

Region ID.

Range

N/A

az_group_id

String

Definition

AZ group ID.

Range

N/A

az_type

String

Definition

AZ type.

Range

  • Core
  • Satellite
  • Dedicated
  • Virtual
  • Edge
  • Edgecentral: central and edge

az_tags

AvailableTag object

Definition

AZ tag.

Range

N/A

az_category

Integer

Definition

Type of the current AZ.

Range

  • 0: AZ on the cloud

  • 21: Local AZ

  • 41: Edge AZ

charge_policy

String

Definition

Sales policy for the current AZ.

Range

  • charge: Charges apply.

  • notCharge: No charges apply.

Table 5 AvailableTag

Parameter

Type

Description

mode

String

Definition

Resource mode, which can be dedicated or shared.

Range

  • dedicated: dedicated AZ.
  • shared: shared AZ.

alias

String

Definition

Alias of an AZ.

Range

N/A

public_border_group

String

Definition

Group to which the AZ belongs. The default value is center.

Range

N/A

Example Request

None

Example Response

Status code: 200

Query AZ information.

{
  "available_zones" : [ {
    "id" : "xxx",
    "az_code" : "xxx",
    "az_name" : "AZ 1",
    "az_id" : "xxx",
    "status" : "Running",
    "region_id" : "xxx",
    "az_type" : "Dedicated",
    "az_group_id" : "",
    "az_tags" : {
      "mode" : null,
      "alias" : null,
      "public_border_group" : "center"
    }
  }, {
    "id" : "xxx",
    "az_code" : "xxx",
    "az_name" : "AZ 2",
    "az_id" : "xxx",
    "status" : "Running",
    "region_id" : "xxx",
    "az_type" : "Dedicated",
    "az_tags" : {
      "mode" : null,
      "alias" : null,
      "public_border_group" : "center"
    }
  }, {
    "id" : "xxx",
    "az_code" : "xxx",
    "az_name" : "AZ 3",
    "az_id" : "xxx",
    "status" : "Running",
    "region_id" : "xxx",
    "az_type" : "Dedicated",
    "az_tags" : {
      "mode" : null,
      "alias" : null,
      "public_border_group" : "center"
    }
  } ],
  "default_az_code" : "xxx",
  "support_physical_az_group" : true
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.mrs.v1.region.MrsRegion;
import com.huaweicloud.sdk.mrs.v1.*;
import com.huaweicloud.sdk.mrs.v1.model.*;


public class ListAvailableZonesSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        MrsClient client = MrsClient.newBuilder()
                .withCredential(auth)
                .withRegion(MrsRegion.valueOf("<YOUR REGION>"))
                .build();
        ListAvailableZonesRequest request = new ListAvailableZonesRequest();
        request.withRegionId("{region_id}");
        try {
            ListAvailableZonesResponse response = client.listAvailableZones(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkmrs.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = MrsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(MrsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListAvailableZonesRequest()
        request.region_id = "{region_id}"
        response = client.list_available_zones(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := mrs.NewMrsClient(
        mrs.MrsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListAvailableZonesRequest{}
	request.RegionId = "{region_id}"
	response, err := client.ListAvailableZones(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Code

See Table 6.

Table 6 Status Code

Status Code

Description

200

AZ information

Error Codes

See Error Codes.