Creating a DCS Instance¶
Function¶
This API is used to create a DCS instance.
Note
The system automatically schedules the task every 3 minutes for checking whether resources are available or sold out.
URI¶
POST /v1.0/{project_id}/instances
Table 1 describes the parameter.
Parameter | Type | Mandatory | Description |
---|---|---|---|
project_id | String | Yes | Project ID. For details on how to obtain the value of this parameter, see Obtaining a Project ID. |
Request¶
Request parameters
Table 2 describes the request parameters.
Parameter | Type | Mandatory | Description |
---|---|---|---|
name | String | Yes | DCS instance name. An instance name can contain 4 to 64 characters and must start with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
description | String | No | Brief description of the DCS 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 | String | Yes | Cache engine. Value: Redis. |
engine_version | String | Yes | Cache engine version. If the cache engine is Redis, the value can be 3.0, 4.0, 5.0, or 6.0. |
spec_code | String | No | DCS instance specification code. To obtain the value, go to the instance creation page on the DCS console, and view Flavor Name in the Instance Specification table. |
capacity | Float | Yes | Cache capacity. Unit: GB.
|
no_password_access | String | Yes | An indicator of whether a DCS instance can be accessed in password-free mode.
Default value: false. |
password | String | No | Password of a DCS instance. Note If no_password_access is set to false or not set, the request must contain the password parameter. The password of a DCS Redis instance must meet the following complexity requirements:
|
vpc_id | String | Yes | VPC ID. Obtain the value by using either of the following methods:
|
security_group_id | String | Yes | ID of the security group which the instance belongs to. This parameter is mandatory when the engine is Redis and engine_version is 3.0. DCS Redis 3.0 instances support security group access control. This parameter is optional when the engine is Redis and engine_version is 4.0 or 5.0. DCS Redis 4.0 and 5.0 instances do not support security groups. Obtain the value by using either of the following methods:
|
subnet_id | String | Yes | Network ID of the subnet. Obtain the value by using either of the following methods:
|
available_zones | Array | Yes | ID of the AZ where the cache node resides and which has available resources. For details on how to obtain the value, see Querying AZ Information. Check whether the AZ has available resources. Master/Standby, Proxy Cluster, and Redis Cluster DCS instances support cross-AZ deployment. You can specify an AZ for the standby node. When specifying AZs for nodes, use commas (,) to separate multiple AZs. For details, see the example request. |
product_id | String | Yes | ID of the product that can be created. For details, see Querying Service Specifications. The parameter value is in the format of spec_code-Abbreviation of the billing mode. The abbreviation of the billing mode can only be h, indicating pay-per-use. For example, redis.single.au1.large.1-h indicates a pay-per-use product whose specification code is redis.single.au1.large.1. Note When obtaining the product ID from the product specifications, ensure that the billing mode specified in the product ID is the same as the selected billing mode. For example, to buy a master/standby DCS Redis 3.0 instance billed in pay-per-use mode, you can search for the product ID corresponding to the record whose charging_type is Hourly and spec_code is dcs.master_standby in the response message. |
instance_backup_policy | Object | No | Backup policy. This parameter is available for master/standby and cluster DCS instances. For details, see Table 3 and Table 4. |
enable_publicip | Boolean | No | An indicator of whether to enable public access for a DCS Redis instance.
|
publicip_id | String | No | ID of the elastic IP address bound to a DCS Redis instance. This parameter is mandatory if public access is enabled (that is, enable_publicip is set to true). |
enable_ssl | Boolean | No | An indicator of whether to enable SSL for public access to a DCS Redis instance.
|
maintain_begin | String | No | Time at which the maintenance time window starts. Format: hh:mm:ss.
|
maintain_end | String | No | Time at which the maintenance time window ends. Format: hh:mm:ss.
|
enterprise_project_id | String | No | Enterprise project ID. |
enterprise_project_name | String | No | Enterprise project name. |
instance_num | Integer | No | Number of instances to be created in batches. Default value: 1. Value range: 1-100. |
private_ips | Array of strings | No | IP address that is manually specified for a DCS instance. |
port | Integer | No | Port customization , which is supported only by Redis 4.0 and later instances and not by Redis 3.0 instances. If this parameter is not sent or is left empty when you create a Redis instance, the default port 6379 will be used. To customize a port, specify a port number in the range from 1 to 65535. |
rename_commands | Object | No | Critical command renaming , which is supported only by Redis 4.0 and later instances and not by Redis 3.0 instances. If this parameter is not sent or is left empty when you create a Redis instance, no critical command will be renamed. Currently, you can rename the COMMAND, KEYS, FLUSHDB, FLUSHALL, HGETALL, SCAN, HSCAN, SSCAN, and ZSCAN commands. |
Parameter | Type | Mandatory | Description |
---|---|---|---|
save_days | Integer | No | This parameter is mandatory when backup_type is set to manual. Retention period. Unit: day. Value range: 1-7. |
backup_type | String | No | Backup type. Options:
The default value is manual. |
periodical_backup_plan | Object | Yes | Backup plan. For details, see Table 4. |
Parameter | Type | Mandatory | Description |
---|---|---|---|
begin_at | String | Yes | Time at which backup starts. "00:00-01:00" indicates that backup starts at 00:00:00. |
period_type | String | Yes | Interval at which backup is performed. Currently, only weekly backup is supported. |
backup_at | Array | Yes | Day in a week on which backup starts. Value range: 1-7, where 1 indicates Monday and 7 indicates Sunday. |
timezone_offset | String | No | Time zone in which backup is performed. Value range: GMT-12:00 to GMT+12:00. If this parameter is left blank, the current time zone of the DCS-Server VM is used by default. |
Example request
Request URL:
POST https://{dcs_endpoint}/v1.0/{project_id}/instances
Example:
Creating a DCS Redis instance
{ "name": "dcs-APITest", "description": "Test", "engine": "Redis", "engine_version": "3.0", "capacity": 2, "enterprise_project_id": "0", "enterprise_project_name": "default", "no_password_access": false, "password": "********", "vpc_id": "0402ea19-5457-4032-9d1b-eb48b98f6c66", "security_group_id": "4b95a790-5cfc-463d-8de5-42199e55371c", "subnet_id": "a3bd29e4-d5bc-414c-a79a-1f35ee4ead88", "available_zones": [ "12c47a78666b4e438cd0c692b9860387" ], "maintain_begin": "02:00", "maintain_end": "06:00", "product_id": "dcs.master_standby-h", "enable_publicip": false, "publicip_id": "", "enable_ssl": false, "private_ips": "", "instance_num": 1 }
Response¶
Response parameters
Table 5 describes the response parameters.
Parameter | Type | Description |
---|---|---|
instance_id | String | DCS instance ID. |
instances | Array of Objects | DCS instance list. For details, see Table 6. |
Parameter | Type | Description |
---|---|---|
instance_id | String | DCS instance ID. |
instance_name | String | DCS instance name. |
Example response
{
"instances": [
{
"instance_id": "3c49fd6b-fc7c-419e-9644-b6cce008653f",
"instance_name": "dcs-test005"
}
],
"instance_id": "3c49fd6b-fc7c-419e-9644-b6cce008653f"
}
Status Code¶
Table 7 describes the status code of successful operations. For details about other status codes, see Table 1.
Status Code | Description |
---|---|
200 | DCS instance created successfully. |