Creating an Instance

Function

This API is used to create a Kafka instance.

Note

This API is out-of-date and may not be maintained in the future. Please use the API described in Creating an Instance.

URI

POST /v2/{project_id}/instances

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a 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

Description of an instance.

The description supports up to 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. Set the value to kafka.

engine_version

Yes

String

Version of the message engine. Options:

  • 1.1.0

  • 2.3.0

  • 2.7

specification

No

String

Baseline bandwidth of a Kafka instance, that is, the maximum amount of data transferred per unit time. Unit: MB Value range:

  • 100 MB

  • 300 MB

  • 600 MB

  • 1200 MB

Note: The value of this parameter is determined by the product ID (product_id) and does not need to set manually.

broker_num

No

Integer

Number of brokers.

This parameter can be left blank.

storage_space

Yes

Integer

Message storage space, in GB.

  • Kafka instance with specification being 100MB: 600-90,000 GB

  • Kafka instance with specification being 300MB: 1200-90,000 GB

  • Kafka instance with specification being 600MB: 2400-90,000 GB

  • Kafka instance with specification being 1200MB: 4800-90,000 GB

partition_num

No

Integer

Maximum number of partitions in a Kafka instance.

  • When specification is 100MB: 300

  • When specification is 300MB: 900

  • When specification is 600MB: 1800

  • When specification is 1200MB: 1800

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:

  • Can contain 8 to 32 characters.

  • Contain 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 which the instance belongs to.

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. Obtain the AZ ID by referring to Listing AZ Information.

This parameter cannot be empty or null. When creating a Kafka instance, you can select either 1 AZ or at least 3 AZ. When specifying AZs for brokers, use commas (,) to separate multiple AZs.

product_id

Yes

String

Product ID.

To create a Kafka instance, the following specifications are available: (product_id/specification/partition_num/storage_space)

00300-30308-0--0/100MB/300/600

00300-30310-0--0/300MB/900/1200

00300-30312-0--0/600MB/1800/2400

00300-30314-0--0/1200MB/1800/4800

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.

  • Parameters maintain_begin and maintain_end must be set in pairs. If parameter maintain_begin is left blank, parameter maintain_end is also left blank. In this case, the system automatically set 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.

  • Parameters maintain_begin and maintain_end must be set in pairs. If parameter maintain_end is left blank, parameter maintain_start is also left blank. In this case, the system automatically set the end time to 06:00.

enable_publicip

No

Boolean

Indicates 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 When specification is 100MB, the value must be a multiple of the number of brokers and fall in the range from 3 to 900. When specification is 300MB, the value must be a multiple of the number of brokers and fall in the range from 3 to 900. When specification is 600MB, the value must be a multiple of the number of brokers and fall in the range from 4 to 1200. When specification is 1200MB, the value must be a multiple of the number of brokers and fall in the range from 8 to 2400.

publicip_id

No

String

ID of the elastic IP address (EIP) bound to an 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

Indicates whether to enable SSL-encrypted access.

This setting is fixed once the instance is created.

  • true: enable

  • false: disable

kafka_security_protocol

No

String

Security protocol to use after SASL is enabled. This parameter is mandatory if SASL authentication is enabled (that is, when ssl_enable is set to true).

If this parameter is left blank, SASL_SSL authentication is enabled by default.

This setting is fixed once the instance is created.

  • SASL_SSL: Data is encrypted with SSL certificates for high-security transmission.

  • SASL_PLAINTEXT: Data is transmitted in plaintext with username and password authentication. This protocol uses the SCRAM-SHA-512 mechanism to deliver better performance.

sasl_enabled_mechanisms

No

Array of strings

Authentication mechanism to use after SASL is enabled. This parameter is mandatory if SASL authentication is enabled (that is, when ssl_enable is set to true).

If this parameter is left blank, PLAIN authentication is enabled by default.

Select both or either of the following mechanisms for SASL authentication.

Options:

  • PLAIN: simple username and password verification.

  • SCRAM-SHA-512: user credential verification, which is more secure than PLAIN.

retention_policy

No

String

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

Options:

  • produce_reject: New messages cannot be created.

  • time_base: The earliest messages are deleted.

disk_encrypted_enable

No

Boolean

Indicates whether to enable disk encryption.

disk_encrypted_key

No

String

Disk encryption key. If disk encryption is not enabled, this parameter is left blank.

connector_enable

No

Boolean

Indicates whether to enable message dumping.

By default, message dumping is disabled.

enable_auto_topic

No

Boolean

Indicates whether to enable automatic topic creation.

  • true: enable

  • false: disable

If automatic topic creation is enabled, a topic will be automatically created with 3 partitions and 3 replicas when a message is produced to or consumed from a topic that does not exist.

The default value is false.

storage_spec_code

Yes

String

Storage I/O specification.

  • The value is dms.physical.storage.high or dms.physical.storage.ultra when the parameter specification is 100MB or 300MB.

  • The value is dms.physical.storage.ultra when the parameter specification is 600MB or 1200MB.

For details on how to select a disk type, see "Disk Types and Disk Performance" in Elastic Volume Service User Guide.

tags

No

Array of TagEntity objects

List of tags.

Table 3 TagEntity

Parameter

Mandatory

Type

Description

key

No

String

Tag key.

  • Cannot be left blank.

  • Must be unique for the same instance.

  • Can contain 1 to 128 characters.

  • Can contain letters, digits, spaces, and special characters _.:=+-@

  • Cannot start or end with a space.

value

No

String

Value.

  • Can contain 0 to 255 characters.

  • Can contain letters, digits, spaces, and special characters _.:=+-@

  • Cannot start or end with a space.

Response Parameters

Status code: 200

Table 4 Response body parameter

Parameter

Type

Description

instance_id

String

Instance ID.

Example Requests

Creating a Kafka instance.

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

{
  "name" : "kafka-test",
  "description" : "",
  "engine" : "kafka",
  "engine_version" : "1.1.0",
  "storage_space" : 300,
  "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,
  "kafka_security_protocol" : "SASL_SSL",
  "sasl_enabled_mechanisms" : [ "SCRAM-SHA-512" ],
  "enable_publicip" : true,
  "publicip_id" : "6db1129f-16af-455d-8d54-************,bb200202-423f-49e4-bae7-************,ca8801e8-6620-42af-b506-************",
  "access_user" : "root",
  "password" : "**********",
  "specification" : "300MB",
  "partition_num" : 900,
  "retention_policy" : "time_base",
  "enable_auto_topic" : true,
  "storage_spec_code" : "dms.physical.storage.ultra"
}

Example Response

Status code: 200

Instance created successfully.

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

Status Code

Status Code

Description

200

Instance created successfully.

Error Codes

See Error Codes.