Updated on 2023-07-20 GMT+08:00

Creating an Instance

Function

This API is used to create a pay-per-use or yearly/monthly-billed instance.

URI

POST /v2/{engine}/{project_id}/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

engine

Yes

String

Message engine.

Default: rabbitmq

project_id

Yes

String

Project ID. For details about how to obtain it, see Obtaining a Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Instance name.

An instance name can contain 4 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

description

No

String

Description of the instance.

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: rabbitmq.

engine_version

Yes

String

Version of the message engine.

  • Supported RabbitMQ versions: 3.8.35 and 3.7.17

storage_space

Yes

Integer

Message storage space in GB. Value range:

  • Single-node RabbitMQ instance: 100–90,000 GB

  • Cluster RabbitMQ instance: 100 GB x Number of nodes to 90,000 GB, 200 GB x Number of nodes to 90,000 GB, and 300 GB x Number of nodes to 90,000 GB

access_user

Yes

String

A username, which must be 4 to 64 characters long and can contain only letters, digits, and hyphens (-).

password

Yes

String

Instance password.

The password must meet the following complexity requirements:

  • Contains 8 to 32 characters.

  • Contains at least two of the following character types:

    • Lowercase letters

    • Uppercase letters

    • Digits

    • Special characters `~!@#$%^&*()-_=+|[{}]:'",<.>/?

vpc_id

Yes

String

VPC ID.

To obtain it, log in to the VPC console and view the VPC ID on the VPC details page.

security_group_id

Yes

String

Security group ID.

To obtain it, log in to the VPC console and view the security group ID on the security group details page.

subnet_id

Yes

String

Subnet ID.

To obtain it, log in to VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.

available_zones

Yes

Array of strings

ID of the AZ where instance brokers reside and which has available resources. Obtain the AZ ID by referring to Listing AZ Information.

This parameter cannot be empty or null.

product_id

Yes

String

Product ID.

Obtain the product ID from Querying Product Specifications List.

If the product is of the cluster type (that is, type is set to cluster), the broker_num field is mandatory.

broker_num

No

Integer

Number of brokers.

If the product is of the single-node type, there can be only 1 broker. If the product is of the cluster type, there can be 3, 5, or 7 brokers.

If the product type is single:

  • 1

If the product type is cluster:

  • 3

  • 5

  • 7

maintain_begin

No

String

Indicates the time at which a maintenance time window starts. Format: HH:mm.

  • The start time and end time of the maintenance time window must indicate the time segment of a supported maintenance time window.

  • The start time must be set to 22:00, 02:00, 06:00, 10:00, 14:00, or 18:00.

  • The start time and end time must be set in pairs. If the start time is left blank, the end time must also be left blank. In this case, the system automatically sets the start time to 02:00.

maintain_end

No

String

Indicates the time at which a maintenance time window ends. Format: HH:mm.

  • The start time and end time of the maintenance time window must indicate the time segment of a supported maintenance time window.

  • The end time is four hours later than the start time. For example, if the start time is 22:00, the end time is 02:00.

  • The start time and end time must be set in pairs. If the end time is left blank, the start time is also left blank. In this case, the system automatically sets the end time to 06:00.

enable_publicip

No

Boolean

Whether to enable public access for the RabbitMQ instance.

  • true: enable

  • false: disable

publicip_id

No

String

ID of the EIP bound to the RabbitMQ instance. This parameter is mandatory if public access is enabled (that is, enable_publicip is set to true).

ssl_enable

No

Boolean

Whether to enable SSL encryption for access.

  • true: enable

  • false: disable

storage_spec_code

Yes

String

Storage I/O specification.

Options:

  • dms.physical.storage.high.v2

  • dms.physical.storage.ultra.v2

  • dms.physical.storage.high.dss.v2 (DeC)

  • dms.physical.storage.ultra.dss.v2 (DeC)

enterprise_project_id

No

String

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

tags

No

Array of TagEntity objects

Tag list.

bss_param

No

BssParam object

Parameter related to the yearly/monthly billing mode.

If this parameter is left blank, the billing mode is pay-per-use by default. If this parameter is not left blank, the billing mode is yearly/monthly.

Table 3 TagEntity

Parameter

Mandatory

Type

Description

key

No

String

Key.

A key can contain 1 to 128 characters.

Include UTF-8 letters, digits, spaces, or the following special characters _.:=+-@

Do not use spaces to start or end the key.

value

No

String

Value.

A value can contain 0 to 255 characters.

Include UTF-8 letters, digits, spaces, or the following special characters _.:/=+-@

A value can be an empty string.

Table 4 BssParam

Parameter

Mandatory

Type

Description

is_auto_renew

No

Boolean

Whether auto renewal is enabled.

Options:

  • true: Auto renewal is enabled.

  • false: Auto renewal is not enabled.

By default, auto renewal is disabled.

charging_mode

No

String

Billing mode.

This parameter specifies a payment mode.

Options:

  • prePaid: yearly/monthly billing.

  • postPaid: pay-per-use billing.

The default value is postPaid.

is_auto_pay

No

Boolean

Specifies whether the order is automatically or manually paid.

Options:

  • true: The order will be automatically paid.

  • false: The order must be manually paid.

The default payment mode is manual.

period_type

No

String

Subscription period type.

Options:

  • month

  • year:

**This parameter is valid and mandatory only when chargingMode is set to prePaid. **

period_num

No

Integer

Subscribed periods.

Options:

  • If periodType is month, the value ranges from 1 to 9.

  • If periodType is year, the value ranges from 1 to 3.

**This parameter is valid and mandatory only when chargingMode is set to prePaid. **

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

instance_id

String

Instance ID.

Example Requests

  • Creating a pay-per-use RabbitMQ instance whose version is 3.8.35, specifications are 2 vCPUs | 4 GB x 1, and storage space is 100 GB

    POST https://{endpoint}/v2/{engine}/{project_id}/instances
    
    {
      "name" : "rabbitmq-demo",
      "description" : "",
      "engine" : "RabbitMQ",
      "engine_version" : "3.8.35",
      "storage_space" : 100,
      "access_user" : "******",
      "password" : "******",
      "vpc_id" : "1e93f86e-13af-46c8-97d6-d40fa62b76c2",
      "security_group_id" : "0aaa0033-bf7f-4c41-a6c2-18cd04cad2c8",
      "subnet_id" : "b5fa806c-35e7-4299-b659-b39398dd4718",
      "available_zones" : [ "d573142f24894ef3bd3664de068b44b0" ],
      "product_id" : "c6.2u4g.single",
      "ssl_enable" : false,
      "enable_publicip" : false,
      "publicip_id" : "",
      "storage_spec_code" : "dms.physical.storage.high.v2"
    }
  • Creating a yearly/monthly RabbitMQ instance whose version is 3.8.35, specifications are 2 vCPUs | 4 GB x 1, and storage space is 100 GB

    POST https://{endpoint}/v2/{engine}/{project_id}/instances
    
    {
      "name" : "rabbitmq-demo",
      "description" : "",
      "engine" : "RabbitMQ",
      "engine_version" : "3.8.35",
      "storage_space" : 100,
      "access_user" : "******",
      "password" : "******",
      "vpc_id" : "1e93f86e-13af-46c8-97d6-d40fa62b76c2",
      "security_group_id" : "0aaa0033-bf7f-4c41-a6c2-18cd04cad2c8",
      "subnet_id" : "b5fa806c-35e7-4299-b659-b39398dd4718",
      "available_zones" : [ "d573142f24894ef3bd3664de068b44b0" ],
      "product_id" : "c6.2u4g.single",
      "ssl_enable" : false,
      "enable_publicip" : false,
      "publicip_id" : "",
      "storage_spec_code" : "dms.physical.storage.high.v2",
      "bss_param" : {
        "charging_mode" : "prePaid",
        "period_type" : "month",
        "period_num" : 1,
        "is_auto_pay" : true
      }
    }

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.