Updated on 2026-02-02 GMT+08:00

Querying an Instance

Function

This API is used to query the details about a specified instance.

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:getDetail

    Read

    rabbitmq *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    dms:instance:get

    • vpc:vpcs:get
    • vpc:ports:get
    • vpc:securityGroups:get
    • vpc:subnets:get
    • eip:publicIps:get

URI

GET /v2/{project_id}/instances/{instance_id}

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

instance_id

Yes

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

access_user

String

Definition:

Authentication username.

Range:

N/A

broker_num

Integer

Definition:

Number of brokers.

Range:

  • 1

  • 3

  • 5

  • 7

name

String

Definition:

Instance name.

Range:

N/A

engine

String

Definition:

Engine type.

Range:

rabbitmq: RabbitMQ engine.

engine_version

String

Definition

Message engine version.

Range

  • 3.8.35

  • AMQP-0-9-1

specification

String

Definition:

Instance flavor.

Range:

  • Single-node instance: VM flavor is returned.

  • Cluster instance: VM flavor and number of brokers are returned.

storage_space

Integer

Definition:

Message storage space, in GB.

Range:

N/A

used_storage_space

Integer

Definition:

Used message storage space, in GB.

Range:

N/A

dns_enable

Boolean

Definition:

Whether to enable domain name access to an instance.

Range:

  • true: yes

  • false: no

connect_address

String

Definition:

Instance IP address for private access.

Range:

N/A

connect_domain_name

String

Definition:

Instance domain name for private access.

Range:

N/A

public_connect_address

String

Definition:

Instance IP address for public access.

Range:

N/A

public_connect_domain_name

String

Definition:

Instance domain name for public access.

Range:

N/A

port

Integer

Definition:

Instance port.

Range:

N/A

status

String

Definition

Instance status.

Range

For details, see Instance Status.

description

String

Definition:

Instance description.

Range:

N/A

instance_id

String

Definition:

Instance ID.

Range:

N/A

resource_spec_code

String

Definition

Resource specification ID.

Range

  • dms.instance.rabbitmq.single.c3.2u4g: single-node RabbitMQ instance, 2 vCPUs 4 GB (VM specifications)

  • dms.instance.rabbitmq.single.c3.4u8g: single-node RabbitMQ instance, 4 vCPUs 8 GB (VM specifications)

  • dms.instance.rabbitmq.single.c3.8u16g: single-node RabbitMQ instance, 8 vCPUs 16 GB (VM specifications)

  • dms.instance.rabbitmq.single.c3.16u32g: single-node RabbitMQ instance, 16 vCPUs 32 GB (VM specifications)

  • dms.instance.rabbitmq.cluster.c3.4u8g.3: cluster RabbitMQ instance, 4 vCPUs 8 GB (VM specifications), 3 nodes

  • dms.instance.rabbitmq.cluster.c3.4u8g.5: cluster RabbitMQ instance, 4 vCPUs 8 GB (VM specifications), 5 nodes

  • dms.instance.rabbitmq.cluster.c3.4u8g.7: cluster RabbitMQ instance, 4 vCPUs 8 GB (VM specifications), 7 nodes

  • dms.instance.rabbitmq.cluster.c3.8u16g.3: cluster RabbitMQ instance, 8 vCPUs 16 GB (VM specifications), 3 nodes

  • dms.instance.rabbitmq.cluster.c3.8u16g.5: cluster RabbitMQ instance, 8 vCPUs 16 GB (VM specifications), 5 nodes

  • dms.instance.rabbitmq.cluster.c3.8u16g.7: cluster RabbitMQ instance, 8 vCPUs 16 GB (VM specifications), 7 nodes

  • dms.instance.rabbitmq.cluster.c3.16u32g.3: cluster RabbitMQ instance, 16 vCPUs 32 GB (VM specifications), 3 nodes

  • dms.instance.rabbitmq.cluster.c3.16u32g.5: cluster RabbitMQ instance, 16 vCPUs 32 GB (VM specifications), 5 nodes

  • dms.instance.rabbitmq.cluster.c3.16u32g.7: cluster RabbitMQ instance, 16 vCPUs 32 GB (VM specifications), 7 nodes

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

user_id

String

Definition:

User ID.

Range:

N/A

user_name

String

Definition:

Username.

Range:

N/A

order_id

String

Definition:

Indicates an order ID. This parameter has a value only when the billing mode is yearly/monthly mode.

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_publicip

Boolean

Definition:

Indicates whether to enable public access for a RabbitMQ instance.

Range:

  • true: yes

  • false: no

publicip_address

String

Definition:

Indicates the EIP bound to a RabbitMQ instance.

The value of this parameter is null if public access is disabled.

Range:

  • true: yes

  • false: no

publicip_id

String

Definition:

Indicates the ID of the EIP bound to a RabbitMQ instance.

The value of this parameter is null if public access is disabled.

Range:

N/A

management_connect_address

String

Definition:

Management address of a RabbitMQ instance.

Range:

N/A

management_connect_domain_name

String

Definition:

Management domain name of a RabbitMQ instance.

Range:

N/A

public_management_connect_address

String

Definition:

Public management address of a RabbitMQ instance.

Range:

N/A

public_management_connect_domain_name

String

Definition:

Public management domain name of a RabbitMQ instance.

Range:

N/A

ssl_enable

Boolean

Definition:

Whether security authentication is enabled.

Range:

  • true: yes

  • false: no

enterprise_project_id

String

Definition:

Enterprise project ID.

Range:

N/A

is_logical_volume

Boolean

Definition:

Distinguishes old instances from new instances during instance capacity expansion.

Range:

  • true: New instance, which allows dynamic disk capacity expansion without restarting the instance.

  • false: Some old instance, which does not support disk capacity expansion.

extend_times

Integer

Definition

Times of scaling up the instance disk.

Range

N/A

type

String

Definition:

Instance type.

Range:

  • single: single-node

  • cluster: cluster

product_id

String

Definition:

Product ID.

Range:

N/A

security_group_id

String

Definition:

Security group ID.

Range:

N/A

security_group_name

String

Definition:

Name of the tenant security group.

Range:

N/A

subnet_id

String

Definition:

Subnet ID.

Range:

N/A

available_zones

Array of strings

Definition:

ID of the AZ where an instance node is located.

available_zone_names

Array of strings

Definition:

Name of the AZ where an instance node is located.

total_storage_space

Integer

Definition:

Total message storage space, in GB.

Range:

N/A

storage_resource_id

String

Definition:

Storage resource ID.

Range:

N/A

storage_spec_code

String

Definition:

I/O specification.

Range:

N/A

ipv6_enable

Boolean

Definition:

Whether IPv6 is enabled.

Range:

  • true: yes

  • false: no

ipv6_connect_addresses

Array of strings

Definition:

IPv6 connection address.

tags

Array of TagEntity objects

Definition:

Tag list.

service_type

String

Definition

Service type.

Range

advanced

storage_type

String

Definition

Storage type.

Range

hec

Table 3 TagEntity

Parameter

Type

Description

key

String

Definition

Tag key.

Constraints

  • Cannot be left blank.

  • Must be unique for the same instance.

  • Can contain 1 to 128 characters.

  • Can contain letters, digits, spaces, and special characters _.:=+-@

  • Cannot start with sys

  • Cannot start or end with a space.

Range

N/A

Default Value

N/A

value

String

Definition

Tag value.

Constraints

  • Can contain 0 to 255 characters.

  • Can contain letters, digits, spaces, and special characters _.:=+-@

Range

N/A

Default Value

N/A

Example Requests

Querying details of a specified instance

GET https://{endpoint}/v2/{project_id}/instances/{instance_id}

Example Responses

Status code: 200

The specified instance is queried successfully.

{
  "name" : "api-explorer",
  "engine" : "rabbitmq",
  "port" : 5672,
  "status" : "RUNNING",
  "type" : "single",
  "specification" : "2vCPUs 4GB",
  "engine_version" : "3.8.35",
  "connect_address" : "192.168.0.74",
  "instance_id" : "de873040-d661-4770-aa96-9329c71d7c8a",
  "resource_spec_code" : "dms.instance.rabbitmq.single.c3.2u4g",
  "charging_mode" : 1,
  "vpc_id" : "40a6501e-85ca-4449-a0db-b8bc7f0cec28",
  "vpc_name" : "vpc-a400",
  "created_at" : "1590047080687",
  "product_id" : "00300-30109-0--0",
  "security_group_id" : "bfd68e26-f8ef-4a91-a373-0a8f5c198601",
  "security_group_name" : "Sys-default",
  "subnet_id" : "a7f9a564-30dd-4059-8124-364ca6554578",
  "available_zones" : [ "9f1c5806706d4c1fb0eb72f0a9b18c77" ],
  "available_zone_names" : [ "AZ1" ],
  "user_id" : "3df5acbc24a54fadb62a043c9000a307",
  "user_name" : "paas_dms_01",
  "maintain_begin" : "22:00:00",
  "maintain_end" : "02:00:00",
  "storage_space" : 88,
  "total_storage_space" : 100,
  "used_storage_space" : 4,
  "enable_publicip" : false,
  "ssl_enable" : false,
  "management_connect_address" : "http://192.168.0.74:15672",
  "storage_resource_id" : "52be287d-1d6a-4d30-937e-185b3f176fc4",
  "storage_spec_code" : "dms.physical.storage.normal",
  "enterprise_project_id" : "0",
  "tags" : [ {
    "key" : "key1",
    "value" : "value1"
  }, {
    "key" : "key2",
    "value" : "value2"
  } ],
  "is_logical_volume" : true,
  "extend_times" : 0,
  "ipv6_enable" : false,
  "ipv6_connect_addresses" : [ ],
  "broker_num" : 1,
  "access_user" : "root_01"
}

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
48
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.rabbitmq.v2.region.RabbitMQRegion;
import com.huaweicloud.sdk.rabbitmq.v2.*;
import com.huaweicloud.sdk.rabbitmq.v2.model.*;


public class ShowInstanceSolution {

    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);

        RabbitMQClient client = RabbitMQClient.newBuilder()
                .withCredential(auth)
                .withRegion(RabbitMQRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowInstanceRequest request = new ShowInstanceRequest();
        request.withInstanceId("{instance_id}");
        try {
            ShowInstanceResponse response = client.showInstance(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
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkrabbitmq.v2.region.rabbitmq_region import RabbitMQRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkrabbitmq.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 = RabbitMQClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(RabbitMQRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowInstanceRequest()
        request.instance_id = "{instance_id}"
        response = client.show_instance(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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    rabbitmq "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/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 := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := rabbitmq.NewRabbitMQClient(
        rabbitmq.RabbitMQClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowInstanceRequest{}
	request.InstanceId = "{instance_id}"
	response, err := client.ShowInstance(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

The specified instance is queried successfully.

Error Codes

See Error Codes.