Creating a Pay-per-Use Instance
Function
This API is used to create a pay-per-use instance.
Debugging
You can use API Explorer to debug this API.
URI
POST /v2/{project_id}/instances
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. |
Request 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 a backslash () or a quotation mark (") 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.
|
| storage_space | Yes | Integer | Message storage space in GB. Value range:
|
| 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:
|
| vpc_id | Yes | String | VPC ID. |
| security_group_id | Yes | String | Security group ID. |
| subnet_id | Yes | String | Subnet ID. |
| available_zones | Yes | Array of strings | ID of the AZ where instance nodes reside and which has available resources. This parameter cannot be empty or null. |
| product_id | Yes | String | Product ID. |
| maintain_begin | No | String | Time at which a maintenance time window starts. Format: HH:mm.
|
| maintain_end | No | String | Time at which a maintenance time window ends. Format: HH:mm.
|
| enable_publicip | No | Boolean | Whether to enable public access for the RabbitMQ instance.
|
| 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-encrypted access.
|
| storage_spec_code | Yes | String | Storage I/O specification. Value range:
|
| 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. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | No | String | Tag key, which can contain a maximum of 36 Unicode characters. The key cannot be left blank or an empty string. It cannot contain nonprintable ASCII (0–31) characters and the following special characters: =*<>,|/ |
| value | No | String | Tag value,which can contain a maximum of 43 Unicode characters. The value cannot be left blank but can be an empty string. It cannot contain nonprintable ASCII (0–31) characters and the following special characters: =*<>,|/ |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| instance_id | String | Instance ID. |
Example Requests
POST https://{endpoint}/v2/{project_id}/instances
{
"name" : "rabbitmq-demo",
"description" : "",
"engine" : "RabbitMQ",
"engine_version" : "3.7.17",
"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" : "00300-30109-0--0",
"maintain_begin" : "22:00",
"maintain_end" : "02:00",
"ssl_enable" : false,
"enable_publicip" : false,
"publicip_id" : "",
"storage_spec_code" : "dms.physical.storage.ultra",
"tags" : [ {
"key" : "key1",
"value" : "value1"
}, {
"key" : "key2",
"value" : "value2"
} ]
} Example Responses
Status code: 200
An instance is created successfully.
{
"instance_id" : "8959ab1c-7n1a-yyb1-a05t-93dfc361b32d"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | An instance is created successfully. |
Error Codes
See Error Codes.
Last Article: Lifecycle Management
Next Article: Listing All Instances
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.