Updated on 2026-10-29 GMT+08:00

Querying the Instance List

Function

This API is used to query the instances of an account by the specified conditions.

Calling Method

For details, see Calling APIs.

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, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dms:instance:list

    List

    rocketmq *

    g:EnterpriseProjectId

    -

    -

URI

GET /v2/{project_id}/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

engine

No

String

Definition

Message engine type.

Constraints

N/A

Range

  • rocketmq: RocketMQ message engine.

  • reliability: RocketMQ message engine alias.

Default Value

N/A

name

No

String

Definition

Instance name.

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

No

String

Definition

Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body.

Constraints

N/A

Range

N/A

Default Value

N/A

status

No

String

Definition

Instance status.

Constraints

N/A

Range

  • CREATING

  • RUNNING

  • RESTARTING

  • DELETING

  • ERROR

  • CREATEFAILED

  • FREEZING

  • FROZEN

  • STARTING: The instance is changing from frozen to running.

  • SHRINKING: The instance is being scaled in.

  • EXTENDING: The instance is being changed.

  • EXTENDEDFAILED: The change failed.

  • ROLLBACK: The instance has been rolled back.

  • ROLLBACKFAILED: The rollback failed.

  • RECYCLE: The instance is in the recycle bin.

  • RESUMING: The instance is being restored from the recycle bin.

  • RECYCLING: The instance is being moved to the recycle bin.

Default Value

N/A

include_failure

No

String

Definition

Whether to return the number of instances that fail to be created.

Constraints

N/A

Range

  • 'true': yes.

  • 'false': no.

Default Value

N/A

exact_match_name

No

String

Definition

Whether to search for the instance that precisely matches a specified instance name.

Constraints

N/A

Range

  • 'true': yes.

  • 'false': no.

Default Value

'false'

enterprise_project_id

No

String

Definition

Enterprise project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

limit

No

Integer

Definition

Number of returned instances of a query.

Constraints

N/A

Range

1–50

Default Value

10

offset

No

Integer

Definition

Offset where the query starts.

Constraints

N/A

Range

≥ 0

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

instances

Array of InstanceDetail objects

Definition

Instance list.

Range

N/A

instance_num

Integer

Definition

Number of instances.

Range

N/A

Table 4 InstanceDetail

Parameter

Type

Description

name

String

Definition

Instance name.

Range

N/A

engine

String

Definition

Message engine type.

Range

  • rocketmq: RocketMQ message engine.

  • reliability: RocketMQ message engine alias.

status

String

Definition

Instance status.

Range

For details, see Instance Status.

description

String

Definition

Instance description.

Range

N/A

type

String

Definition

Instance type.

Range

  • single: 4.8.0 single-node.

  • cluster: 4.8.0 cluster.

  • single.basic: 5.x single-node basic edition.

  • cluster.basic: 5.x cluster basic edition.

  • single.professional: 5.x single-node professional edition.

  • cluster.professional: 5.x cluster professional edition.

specification

String

Definition

Specification description.

Range

  • For version 4.8.0, the value consists of the resource flavor and number of brokers, for example, rocketmq.4u8g.cluster.small * 1 broker.

  • For the 5.x basic edition, the value consists of the resource flavor and instance TPS, for example, rocketmq.b2.large.4, 2000 tps.

  • For the 5.x single-node professional edition, the value consists of the resource flavor and instance TPS, for example, rocketmq.p1.large.1, 500 tps.

  • For the 5.x cluster professional edition, the value consists of the resource flavor, instance TPS, and elastic TPS, for example, rocketmq.p2.large.8, 4000 tps, 2000 elastic_tps.

For details about resource flavors and other parameters, see the instance specification table of the corresponding version in Specifications

engine_version

String

Definition

Instance version.

Range

  • 4.8.0

  • 5.x

instance_id

String

Definition

Instance ID.

Range

N/A

arch_type

String

Definition

Architecture type.

Range

  • X86

  • ARM

charging_mode

Integer

Definition

Billing mode.

Range

1: pay-per-use; 0: yearly/monthly.

vpc_id

String

Definition

VPC ID.

Range

N/A

vpc_name

String

Definition

VPC name.

Range

N/A

created_at

String

Definition

Time when creation is complete.

The time is in the format of timestamp, that is, the offset milliseconds from 1970-01-01 00:00:00 UTC to the specified time.

Range

N/A

product_id

String

Definition

RocketMQ instance specifications.

Range

  • c6.4u8g.cluster.small: Max. 2,000 topics and 2,000 consumer groups per broker.

  • c6.4u8g.cluster: Max. 4,000 topics and 4,000 consumer groups per broker.

  • c6.8u16g.cluster: Max. 8,000 topics and 8,000 consumer groups per broker.

  • c6.12u24g.cluster: Max. 12,000 topics and 12,000 consumer groups per broker.

  • c6.16u32g.cluster: Max. 16,000 topics and 16,000 consumer groups per broker.

  • rocketmq.b1.large.1: RocketMQ 5.x basic edition single-node flavor, instance TPS 500.

  • rocketmq.b2.large.4: RocketMQ 5.x basic edition, cluster flavor, instance TPS 2,000.

  • rocketmq.b2.large.8: RocketMQ 5.x basic edition, cluster flavor, instance TPS 4,000.

  • rocketmq.b2.large.12: RocketMQ 5.x basic edition, cluster flavor, instance TPS 6,000.

  • rocketmq.p1.large.1: RocketMQ 5.x professional edition, single-node flavor, instance TPS 500.

  • rocketmq.p2.large.8: RocketMQ 5.x professional edition, cluster flavor, instance TPS 4,000.

  • rocketmq.p2.large.12: RocketMQ 5.x professional edition, cluster flavor, instance TPS 6,000.

  • rocketmq.p2.large.20: RocketMQ 5.x professional edition, cluster flavor, instance TPS 10,000.

  • rocketmq.p2.large.40: RocketMQ 5.x professional edition, cluster flavor, instance TPS 20,000.

  • rocketmq.p2.large.100: RocketMQ 5.x professional edition, cluster flavor, instance TPS 50,000.

  • rocketmq.p2.large.150: RocketMQ 5.x professional edition, cluster flavor, instance TPS 75,000.

  • rocketmq.p2.large.200: RocketMQ 5.x professional edition, cluster flavor, instance TPS 100,000.

  • rocketmq.p2.large.300: RocketMQ 5.x professional edition, cluster flavor, instance TPS 150,000.

security_group_id

String

Definition

Security group ID.

Range

N/A

security_group_name

String

Definition

Security group name.

Range

N/A

subnet_id

String

Definition

Subnet ID.

Range

N/A

subnet_cidr

String

Definition

Subnet route.

Range

N/A

available_zones

Array of strings

Definition

List of AZ IDs.

Range

N/A

available_zone_names

Array of strings

Definition

List of AZ names.

Range

N/A

user_id

String

Definition

User ID.

Range

N/A

user_name

String

Definition

Username.

Range

N/A

maintain_begin

String

Definition

Time at which the maintenance window starts. The format is HH:mm:ss.

Range

N/A

maintain_end

String

Definition

Time at which the maintenance window ends. The format is HH:mm:ss.

Range

N/A

enable_log_collection

Boolean

Definition

Whether log collection is enabled.

Range

  • true: yes.

  • false: no.

storage_space

Integer

Definition

Storage space, in GB.

Range

The storage space varies depending on instance flavors.

used_storage_space

Integer

Definition

Used message storage space, in GB.

Range

N/A

enable_publicip

Boolean

Definition

Whether to enable public access.

Range

  • true: Enable public access.

  • false: Disable public access.

publicip_id

String

Definition

ID of the EIP bound to the instance.

Use commas (,) to separate multiple EIP IDs.

This parameter is mandatory if public access is enabled (that is, enable_publicip is set to true).

Range

N/A

publicip_address

String

Definition

Public IP address.

Range

N/A

ssl_enable

Boolean

Definition

Whether SSL is enabled.

Range

  • true: yes.

  • false: no.

cross_vpc_info

String

Definition

Cross-VPC access information.

Range

N/A

storage_resource_id

String

Definition

Storage resource ID.

Range

N/A

storage_spec_code

String

Definition

Storage specification code.

Range

  • dms.physical.storage.high.v2: high I/O disk. RocketMQ 5.x professional edition does not support this value.

  • dms.physical.storage.ultra.v2: ultra-high I/O disk.

  • dms.physical.storage.general: general-purpose SSD.

  • dms.physical.storage.extreme: extreme SSD.

service_type

String

Definition

Service type.

Range

  • advanced: Huawei Cloud service type.

  • dec: dedicated cloud service type.

storage_type

String

Definition

Storage type.

Range

  • hec: Huawei Cloud storage type.

  • dss: dedicated cloud storage type.

extend_times

Long

Definition

Extension time.

Range

N/A

ipv6_enable

Boolean

Definition

Whether IPv6 is enabled.

Range

  • true: yes.

  • false: no.

support_features

String

Definition

Features supported by the instance.

Range

N/A

disk_encrypted

Boolean

Definition

Whether disk encryption is enabled.

Range

  • true: yes.

  • false: no.

disk_encrypted_key

String

Definition

Disk encryption key. If disk encryption is not enabled, this parameter is left blank.

Range

N/A

ces_version

String

Definition

Cloud Eye version.

Range

N/A

node_num

Integer

Definition

Number of nodes. (This field is available only for RocketMQ 4.8.0 instances.)

Range

N/A

new_spec_billing_enable

Boolean

Definition

Whether billing based on new specifications is enabled.

Range

  • true: yes.

  • false: no.

enable_acl

Boolean

Definition

Whether to enable access control.

Range

  • true: yes.

  • false: no.

broker_num

Integer

Definition

Number of brokers.

Range

N/A

dns_enable

Boolean

Definition

Whether to enable domain name access for the instance.

Range

  • true: Enable this function.

  • false: Disable this function.

namesrv_address

String

Definition

Metadata address.

Range

N/A

namesrv_domain_name

String

Definition

Metadata domain name.

Range

N/A

broker_address

String

Definition

Service data address.

Range

N/A

ipv6_broker_address

String

Definition

IPv6 address of the service data.

Range

N/A

public_namesrv_address

String

Definition

Public network metadata address.

Range

N/A

ipv6_namesrv_address

String

Definition

IPv6 address of the metadata.

Range

N/A

public_namesrv_domain_name

String

Definition

Public metadata domain name.

Range

N/A

public_broker_address

String

Definition

Public network service data address.

Range

N/A

grpc_address

String

Definition

gRPC connection address (displayed only for RocketMQ 5.x).

Range

N/A

grpc_domain_name

String

Definition

gRPC connection domain name (displayed only for RocketMQ 5.x).

Range

N/A

public_grpc_address

String

Definition

Public gRPC connection address (displayed only for RocketMQ 5.x).

Range

N/A

public_grpc_domain_name

String

Definition

Public gRPC connection domain name (displayed only for RocketMQ 5.x).

Range

N/A

enterprise_project_id

String

Definition

Enterprise project ID.

Range

N/A

tags

Array of TagEntity objects

Definition

Tag list.

Range

N/A

total_storage_space

Integer

Definition

Total storage space.

Range

N/A

resource_spec_code

String

Definition

Resource specification.

Range

N/A

produce_portion

Integer

Definition

Production TPS proportion.

Range

N/A

consume_portion

Integer

Definition

Consumption TPS proportion.

Range

N/A

dr_enable

Boolean

Definition

Whether the instance has disaster recovery (DR).

Range

  • true: yes.

  • false: no.

quota_address

String

Definition

Quota address.

Range

N/A

max_msg_process_tps

Integer

Definition

Maximum message TPS.

Range

N/A

config_ssl_need_restart_process

Boolean

Definition

Whether a restart is required to configure SSL.

Range

  • true: yes.

  • false: no.

tls_mode

String

Definition

Security protocol used by an instance.

Range

N/A

enable_elastic_tps

Boolean

Definition

Elastic TPS switch status.

Range

  • true: enabled.

  • false: disabled.

Table 5 TagEntity

Parameter

Type

Description

key

String

Definition

Tag key.

Range

N/A

value

String

Definition

Tag value.

Range

N/A

Example Requests

Querying the list of all instances

GET https://{endpoint}/v2/{project_id}/instances?engine=reliability

Example Responses

Status code: 200

{
  "instances" : [ {
    "name" : "reliability-ztest",
    "engine" : "reliability",
    "status" : "RUNNING",
    "description" : "",
    "type" : "cluster",
    "specification" : "rocketmq.4u8g.cluster * 1 broker",
    "engine_version" : "4.8.0",
    "instance_id" : "68fdc9a8-805e-439d-8dd9-25adc1c58bf6",
    "resource_spec_code" : "",
    "charging_mode" : 1,
    "vpc_id" : "3db8490c-4d6d-4d8f-8d3f-047b0de4c5cf",
    "vpc_name" : "vpc-1101840",
    "created_at" : "1636699753874",
    "product_id" : "c6.4u8g.cluster",
    "security_group_id" : "23c5977f-ff33-4b95-a73e-08d8a0bc4e6c",
    "security_group_name" : "Sys-default",
    "subnet_id" : "0a0f1fcb-f019-458d-b9e5-301867394d50",
    "subnet_cidr" : "192.168.0.0/24",
    "available_zones" : [ "9f1c5806706d4c1fb0eb72f0a9b18c77" ],
    "available_zone_names" : [ "AZ3" ],
    "user_id" : "0b01fbb53600d4671fa8c00673c71260",
    "user_name" : "",
    "maintain_begin" : "02:00:00",
    "maintain_end" : "06:00:00",
    "enable_log_collection" : false,
    "storage_space" : 558,
    "total_storage_space" : 600,
    "used_storage_space" : 28,
    "enable_publicip" : false,
    "ssl_enable" : false,
    "arch_type" : "X86",
    "cross_vpc_info" : "{\"192.168.1.21\":{\"advertised_ip\":\"192.168.1.21\",\"broker_port\":\"-\",\"port_id\":\"fa020857-d899-497c-a5f8-8dd90ed67ff7\",\"namesrv_port\":\"8301\"},\"192.168.1.246\":{\"advertised_ip\":\"192.168.1.246\",\"broker_port\":\"10100\",\"port_id\":\"c0f0586f-a4ee-41b5-a7f1-b4e554bbf12d\",\"namesrv_port\":\"-\"},\"192.168.1.77\":{\"advertised_ip\":\"192.168.1.77\",\"broker_port\":\"10101\",\"port_id\":\"8eb1d144-4315-402f-8498-37c9a10b630c\",\"namesrv_port\":\"-\"},\"192.168.1.159\":{\"advertised_ip\":\"192.168.1.159\",\"broker_port\":\"-\",\"port_id\":\"d35b22af-a202-4329-bda4-26e1bdf2aa8e\",\"namesrv_port\":\"8300\"},\"192.168.1.14\":{\"advertised_ip\":\"192.168.1.14\",\"broker_port\":\"10102\",\"port_id\":\"5fcb50fd-3af5-4123-a455-a67f1b926026\",\"namesrv_port\":\"-\"}}",
    "storage_resource_id" : "164bdaef-2e67-4fd5-be8b-a18f91d455a2",
    "storage_spec_code" : "dms.physical.storage.ultra.v2",
    "service_type" : "advanced",
    "storage_type" : "hec",
    "enterprise_project_id" : "0",
    "extend_times" : 0,
    "ipv6_enable" : false,
    "support_features" : "features.log.collection",
    "disk_encrypted" : true,
    "disk_encrypted_key" : "********-b953-4875-a743-************",
    "enable_acl" : true,
    "ces_version" : "linux,v1,v2",
    "node_num" : 5,
    "new_spec_billing_enable" : true,
    "broker_num" : 1,
    "dr_enable" : false,
    "namesrv_address" : "***",
    "config_ssl_need_restart_process" : false,
    "broker_address" : "***",
    "public_namesrv_address" : "***",
    "public_broker_address" : "***",
    "grpc_address" : "***",
    "public_grpc_address" : "***"
  } ],
  "instance_num" : 1
}

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
47
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.rocketmq.v2.region.RocketMQRegion;
import com.huaweicloud.sdk.rocketmq.v2.*;
import com.huaweicloud.sdk.rocketmq.v2.model.*;


public class ListInstancesSolution {

    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");
        String projectId = "{project_id}";

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

        RocketMQClient client = RocketMQClient.newBuilder()
                .withCredential(auth)
                .withRegion(RocketMQRegion.valueOf("<YOUR REGION>"))
                .build();
        ListInstancesRequest request = new ListInstancesRequest();
        try {
            ListInstancesResponse response = client.listInstances(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 huaweicloudsdkrocketmq.v2.region.rocketmq_region import RocketMQRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkrocketmq.v2 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"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

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

    try:
        request = ListInstancesRequest()
        response = client.list_instances(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
37
38
39
40
41
42
43
44
45
46
47
48
49
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    rocketmq "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/v2/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")
    projectId := "{project_id}"

    auth, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := rocketmq.RocketMQClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := rocketmq.NewRocketMQClient(hcClient)

    request := &model.ListInstancesRequest{}
	response, err := client.ListInstances(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 Codes

Status Code

Description

200

Instance list queried.

Error Codes

See Error Codes.