Updated on 2023-05-06 GMT+08:00

Creating a Pay-per-Use Instance

Function

This API is used to create a pay-per-use instance.

URI

POST /v2/{project_id}/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Instance name.

An instance name starts with a letter, consists of 4 to 64 characters, and can contain only letters, digits, underscores (_), and hyphens (-).

description

No

String

Instance description.

The description can contain a maximum of 1024 characters.

NOTE:

The backslash () and quotation mark (") are special characters for JSON messages. When using these characters in a parameter value, add the escape character () before the characters, for example, \ and ".

engine

Yes

String

Message engine. Value: reliability.

engine_version

Yes

String

Version of the message engine. Value: 4.8.0.

storage_space

Yes

Integer

Storage space

vpc_id

Yes

String

VPC ID.

To obtain it, perform the following steps:

  • Log in to the VPC console and view the VPC ID in the VPC details.

subnet_id

Yes

String

Subnet information.

To obtain it, perform the following steps:

  • Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.

security_group_id

Yes

String

ID of the security group to which the instance belongs.

To obtain it, perform the following steps:

  • Log in to the VPC console and view the security group ID on the security group details page.

available_zones

Yes

Array of strings

ID of the AZ where instance brokers reside and which has available resources. The parameter value cannot be empty or null. Check whether resources exist in the AZs.

A RocketMQ instance can be deployed in 1 AZ or at least 3 AZs. When specifying AZs for brokers, separate multiple AZs with commas (,).

product_id

Yes

String

RocketMQ instance specifications.

  • c6.4u8g.cluster: maximum number of topics on each broker: 4000; maximum number of consumer groups on each broker: 4000

  • c6.8u16g.cluster: maximum number of topics on each broker: 8000; maximum number of consumer groups on each broker: 8000

  • c6.12u24g.cluster: maximum number of topics on each broker: 12,000; maximum number of consumer groups on each broker: 12,000

  • c6.16u32g.cluster: maximum number of topics on each broker: 16,000; maximum number of consumer groups on each broker: 16,000

ssl_enable

No

Boolean

Whether to enable SSL encryption for access.

  • true: enable

  • false: disable

storage_spec_code

Yes

String

Storage I/O specification.

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

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

enterprise_project_id

No

String

Enterprise project ID. This parameter is mandatory for an enterprise project account.

enable_acl

No

Boolean

Whether to enable access control.

ipv6_enable

No

Boolean

Whether to support IPv6.

  • true: support

  • false: do not support

Default: false

enable_publicip

No

Boolean

Whether to enable public access. By default, public access is disabled.

  • true: enable

  • false: do not enable

Default: false

publicip_id

No

String

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

broker_num

Yes

Integer

Number of brokers.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

instance_id

String

Instance ID.

Example Requests

Creating a pay-per-use instance

POST https://{endpoint}/v2/{project_id}/instances

{
  "name" : "reliability-1751840557",
  "description" : "",
  "engine" : "reliability",
  "engine_version" : "4.8.0",
  "storage_space" : 600,
  "vpc_id" : "3db8490c-4d6d-4d8f-8d3f-047b0de4c5cf",
  "subnet_id" : "0a0f1fcb-f019-458d-b9e5-301867394d50",
  "security_group_id" : "23c5977f-ff33-4b95-a73e-08d8a0bc4e6c",
  "available_zones" : [ "9f1c5806706d4c1fb0eb72f0a9b18c77" ],
  "product_id" : "c6.4u8g.cluster",
  "enterprise_project_id" : "0",
  "ssl_enable" : false,
  "storage_spec_code" : "dms.physical.storage.ultra.v2",
  "ipv6_enable" : false,
  "enable_publicip" : false,
  "publicip_id" : "",
  "broker_num" : 1
}

Example Responses

Status code: 200

Instance created successfully.

{
  "instance_id" : "8959ab1c-7n1a-yyb1-a05t-93dfc361b32d"
}

Status Codes

Status Code

Description

200

Instance created successfully.

Error Codes

See Error Codes.