Updated on 2024-11-12 GMT+08:00

Creating a CBH Instance

Function

Creating a CBH Instance

URI

POST /v2/{project_id}/cbs/instance

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

For details about how to obtain the project ID, see "Obtaining a Project ID".

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

For details, see "Obtaining the Token of an IAM User."

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

specification

Yes

String

ID of the specification of the CBH instance to be created, for example:

  • cbh.basic.50

  • cbh.enhance.50

For details, see "Querying CBH Instance Specifications."

instance_name

Yes

String

CBH instance name. The requirements are as follows:

The parameter value consists of 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-).

Example: CBH-6b8e

password

Yes

String

Password for logging in to the CBH instance.

The password can contain 8 to 32 characters, excluding amdin, nidma, and their uppercase letters. A password must contain at least three types of the following: uppercase letters, lowercase letters, digits, and special characters.

region

Yes

String

ID of the site where the CBH instance was created.

For details, see "Querying CBH Instance Specifications."

availability_zone

Yes

String

Name of the AZ where the CBH instance is located. (In active/standby mode, the AZ where the active instance locates is required.)

For details, see "Obtaining AZs Where CBH Is Available."

slave_availability_zone

No

String

Name of the AZ where the standby CBH instance is located. (This parameter is not required when only a single-node instance is created.)

For details, see "Obtaining AZs Where CBH Is Available."

charging_mode

Yes

Integer

Billing mode.

  • 0: yearly/monthly billing mode.

period_type

No

Integer

Subscription type. (Mandatory for the yearly/monthly billing mode)

  • 2: month

  • 3: year

period_num

No

Integer

Number of subscription periods. (Mandatory for the yearly/monthly billing mode)

  • If period_type is set to 2 (month), the value ranges from 1 to 9.

  • If period_type is set to 3 (year), the value ranges from 1 to 10.

is_auto_renew

No

Integer

Whether auto-renewal is enabled.

  • 1: Auto-renewal is enabled.

  • 0: Auto-renewal is disabled.

The default value is 0.

is_auto_pay

No

Integer

Whether an order is automatically paid from your Huawei Cloud account.

  • 1: Yes. (Discounts and coupons are automatically selected. The fee will be automatically deducted from your Huawei Cloud account.) If the automatic payment fails, an unpaid order will be generated, and you need to manually complete the payment. (During manual payment, you can still modify the discounts and coupons that were automatically selected.)

  • 0: No. (The customer needs to manually pay for the bill. Discounts and coupons can be used.)

The default value is 0.

network

Yes

NetworkInfoCreate object

The network information required for changing the VPC the CBH instance belongs to.

ipv6_enable

No

Boolean

Whether the CBH instance supports IPv6 addresses.

The default value is false.

enterprise_project_id

No

String

Enterprise project ID.

The default value is 0.

attach_disk_size

No

Integer

Additional disk size. Unit: TB

NOTE The total size of the additional disk and the built-in disk cannot exceed 300 TB.

tags

No

Array of ResourceTag objects

Tag details.

Table 4 NetworkInfoCreate

Parameter

Mandatory

Type

Description

vpc_id

Yes

String

ID of the VPC to which the ECS belongs. The value is in UUID format.

You can obtain the VPC ID from the management console or by following the instructions provided in "Querying VPCs" in Virtual Private Cloud API Reference.

Example: 03211ecf-xxxx-4306-xxxx-6e939bfxxxxx

subnet_id

Yes

String

Subnet ID, which consists of letters, digits, and underscores (_).

public_ip

Yes

PublicIp object

EIP bound to the CBH instance. The value can be null.

security_groups

Yes

Array of SecurityGroup objects

Security group information.

private_ip

No

PrivateIp object

EIP bound to the CBH instance.

Table 5 PublicIp

Parameter

Mandatory

Type

Description

id

No

String

ID of the EIP.

public_eip

No

String

Elastic IP address.

Table 6 SecurityGroup

Parameter

Mandatory

Type

Description

id

Yes

String

ID of the security group that the CBH instance belongs to. The value consists of letters, digits, and underscores (_).

Table 7 PrivateIp

Parameter

Mandatory

Type

Description

ip

Yes

String

Private IP address.

slave_ip

No

String

Private IP address of standby instance.

floating_ip

No

String

Floating IP address.

Table 8 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. The value can contain up to 128 characters.

value

Yes

String

Tag value. A maximum of 255 characters are allowed for a tag value.

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

order_id

String

Order ID.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_description

String

Incorrect request parameters.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_description

String

Failed to verify the token.

Status code: 403

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_description

String

Permissions required.

Status code: 404

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_description

String

Not CBH instances found.

Example Requests

{
  "specification" : "cbh.basic.50",
  "instance_name" : "CBH-155f",
  "password" : "1xxx6xxxx",
  "region" : "cn-north-4",
  "availability_zone" : "cn-north-4a",
  "slave_availability_zone" : "cn-north-4a",
  "charging_mode" : 0,
  "period_type" : 2,
  "period_num" : 1,
  "is_auto_renew" : 0,
  "is_auto_pay" : 0,
  "ipv6_enable" : false,
  "enterprise_project_id" : "0",
  "attach_disk_size" : 1,
  "tags" : [ {
    "key" : "key",
    "value" : "value"
  } ],
  "network" : {
    "vpc_id" : "279e8217-xxxx-4d83-xxxx-b8f14d47170b",
    "subnet_id" : "a86217e6-xxxx-4803-xxxx-b57da681xxxx",
    "private_ip" : {
      "ip" : "123.xxx.41.xx",
      "slave_ip" : "123.xxx.41.xx",
      "floating_ip" : "123.xxx.41.xx"
    },
    "public_ip" : {
      "id" : "cfcab481-xxxx-4e23-xxxx-d6cdd0efxxxx",
      "public_eip" : "123.xxx.41.xx"
    },
    "security_groups" : [ {
      "id" : "1e10bc4f-xxxx-4452-xxxx-8ddb4348xxx"
    } ]
  }
}

Example Responses

Status code: 200

Cbh Create Instance Success

{
  "order_id" : "CS22xxx82xx5AssGxxx"
}

Status Codes

Status Code

Description

200

Cbh Create Instance Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.