Updated on 2022-09-15 GMT+08:00

Creating an Instance

Function

This API is used to create a pay-per-use Kafka 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: kafka.

engine_version

Yes

String

Version of the message engine. Value: 1.1.0 and 2.3.0.

specification

No

String

This parameter indicates the bandwidth of the instance, that is, the maximum amount of data that can be transferred per unit time. Unit: MB. Options:

  • 100MB

  • 300MB

  • 600MB

  • 1200MB

broker_num

No

Integer

Number of brokers.

storage_space

Yes

Integer

Message storage space in GB. Value range:

  • 600–90,000 GB for 100 MB/s Kafka instances

  • 1200–90,000 GB for 300 MB/s Kafka instances

  • 2400–90,000 GB for 600 MB/s Kafka instances

  • 4800–90,000 GB for 1200 MB/s Kafka instances

partition_num

No

Integer

Maximum number of partitions in a Kafka instance.

  • The value is 300 when specification is 100MB.

  • The value is 900 when specification is 300MB.

  • The value is 1800 when specification is 600MB.

  • The value is 1800 when specification is 1200MB.

access_user

No

String

This parameter is mandatory when ssl_enable is set to true. This parameter is invalid when ssl_enable is set to false.

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

password

No

String

This parameter is mandatory when ssl_enable is set to true. This parameter is invalid when ssl_enable is set to false.

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

ID of the security group to which the instance belongs.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 information.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. This parameter cannot be empty or null.A Kafka 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

Product ID.The product ID can be obtained by calling the Querying Product Specifications List API. The product ID format may vary depending on the site.One format contains both digits and letters, for example, c6.2u4g.cluster. The other format contains only digits, for example, 00300-30308-0--0.

kafka_manager_user

Yes

String

Username for logging in to Kafka Manager. The username consists of 4 to 64 characters and can contain only letters, digits, and hyphens (-).

kafka_manager_password

Yes

String

Password for logging in to Kafka Manager.

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

maintain_begin

No

String

Time at which the 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

Time at which the 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. By default, public access is disabled.

  • true: enable

  • false: disable

public_bandwidth

No

Integer

Public network bandwidth. Unit: Mbit/s.

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

ssl_enable

No

Boolean

Whether to enable SSL encryption for access.

This setting is fixed once the instance is created.

  • true: enable

  • false: disable

retention_policy

No

String

Action to be taken when the memory usage reaches the disk capacity threshold.

The value can be:

  • produce_reject: New messages cannot be created.

  • time_base: The earliest messages are deleted.

enable_auto_topic

No

Boolean

Whether to enable automatic topic creation.

  • true: enable

  • false: disable

If it is enabled, a topic will be automatically created with 3 partitions and 3 replicas when a message is created in or retrieved from a topic that does not exist.

The default value is false.

storage_spec_code

Yes

String

Storage I/O specification. - dms.physical.storage.high or dms.physical.storage.ultra when the parameter specification is 100MB - dms.physical.storage.high or dms.physical.storage.ultra when the parameter specification is 300MB - dms.physical.storage.ultra when the parameter specification is 600MB - dms.physical.storage.ultra when the parameter specification is 1200MB For details on how to select a disk type, see "Disk Types and Disk Performance".

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.

Table 3 TagEntity

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 be 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 or be an empty string.

It cannot contain nonprintable ASCII (0–31) characters and the following special characters: =*<>,|/

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

instance_id

String

Instance ID.

Example Requests

{
  "name" : "kafka-test",
  "description" : "",
  "engine" : "kafka",
  "engine_version" : "1.1.0",
  "storage_space" : 300,
  "kafka_manager_user" : "root",
  "kafka_manager_password" : "**********",
  "vpc_id" : "23921d2a-****-****-****-5f2fa5327a48",
  "security_group_id" : "2e888928-****-****-****-e36c6520d473",
  "subnet_id" : "37bb12c9-****-****-****-ae8f7d336ab6",
  "available_zones" : [ "a0865121f83b41cbafce65930a22a6e8" ],
  "product_id" : "00300-30310-0--0",
  "maintain_begin" : "22:00",
  "maintain_end" : "02:00",
  "ssl_enable" : true,
  "enable_publicip" : true,
  "publicip_id" : "",
  "access_user" : "root",
  "password" : "**********",
  "enterprise_project_id" : "0",
  "specification" : "300MB",
  "partition_num" : 900,
  "retention_policy" : "time_base",
  "public_boundwidth" : 3,
  "connector_enable" : false,
  "enable_auto_topic" : true,
  "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.