Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a DCS Instance

Updated on 2023-12-13 GMT+08:00

Function

This API is used to create a DCS instance which is billed in pay-per-use mode.

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 can contain letters, digits, underscores (_), and hyphens (-) and must start with a letter or digit.

When you create only one instance at a time, the value of this parameter can contain 4 to 64 characters. When you create multiple instances at a time, the value of this parameter can contain 4 to 56 characters. The instances are named in the format of custom name-n, where n starts from 000 and is incremented by 1. For example, if you create two instances and set the custom name to dcs_demo, the two instances are respectively named dcs_demo-000 and dcs_demo-001.

engine

Yes

String

Cache engine: Redis.

engine_version

No

String

Cache engine version.

If the cache engine is Redis, this parameter is mandatory. The version can be 4.0.

capacity

Yes

Float

Cache capacity (GB).

For a single-node or master/standby DCS Redis 4.0 or 5.0 instance, the value can be 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, or 64. For a cluster instance, the value can be 4, 8, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, or 1024.

spec_code

Yes

String

Product flavor. The query method is as follows:

az_codes

Yes

Array of strings

ID of the AZ where the cache node resides and which has available resources. ID of the AZ where the cache node resides and which has available resources. For details, see Querying AZs. Check whether the desired 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.

vpc_id

Yes

String

VPC ID.

You can obtain it in either of the following ways:

  • Method 1: Log in to the VPC console and view the VPC ID on the My VPCs page.

  • Method 2: Call the VPC API. For details, see .

subnet_id

Yes

String

Subnet network ID.

You can obtain it in either of the following ways:

  • Method 1: Log in to VPC console and click the target subnet on the Subnets tab page. You can view the network ID on the displayed page.

  • Method 2: Call the VPC API. For details, see .

security_group_id

No

String

ID of the security group to which the instance belongs.

This parameter is optional when engine is Redis and engine_version is . DCS Redis 4.0 instances do not support security groups. They support only whitelist-based access control.

You can obtain it in either of the following ways:

  • Method 1: Log in to the VPC console and view the security group ID on the security group details page.

  • Method 2: Call the API used to query security group details. For details, see . "

publicip_id

No

String

ID of the EIP bound to the DCS Redis instance.

Default: false

enterprise_project_id

No

String

Enterprise project ID.

enterprise_project_name

No

String

Name of an enterprise project.

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 \".

enable_ssl

No

Boolean

|-

private_ip

No

String

IP address that is manually specified for a DCS instance. This parameter is available for DCS Redis instances.

instance_num

No

Integer

Number of instances to be created in batches. This parameter is available for DCS Redis instances.

Default value: 1.

Value range: 1 to 100

Default: 1

maintain_begin

No

String

.

maintain_end

No

String

.

password

No

String

DCS instance authentication information.

NOTE:

When no_password_access is set to false or not specified, the request must contain the password parameter. The password of a DCS Redis instance must meet the following complexity requirements:

  • Must be a string consisting of 8 to 64 characters.

  • The new password must be different from the old password.

  • Must contain at least three of the following character types:

    • Lowercase letters

    • Uppercase letters

    • Digits

    • Special characters `~!@#$^&*()-_=+\|{},<.>/?

no_password_access

No

Boolean

Whether the instance can be accessed without a password.

  • true: The instance can be accessed without a password.

  • false: The instance can be accessed only after password authentication. If this parameter is not set, the default value false is used.

Default: false

bss_param

No

BssParam object

Parameter related to the billing mode. If this parameter is left blank, the default billing mode is pay-per-use.

instance_backup_policy

No

BackupPolicy object

Backup policy. This parameter is supported when the instance type is master/standby or cluster.

tags

No

Array of ResourceTag objects

Instance tag key and value.

access_user

No

String

|-

enable_publicip

No

Boolean

|-

Default: false

port

No

Integer

Port customization.

If this parameter is not sent or is left empty when you create a Redis 4.0 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

No

Object

Critical command renaming.

If this parameter is not sent or is left empty when you create a Redis 4.0 instance, no critical command will be renamed. Currently, only COMMAND, KEYS, FLUSHDB, FLUSHALL, SCAN, HSCAN, SSCAN, ZSCAN, and HGETALL commands can be renamed.

template_id

No

String

Parameter template ID.

Table 3 BssParam

Parameter

Mandatory

Type

Description

is_auto_renew

No

String

|-

Default: false

charging_mode

Yes

String

The default value is postPaid, indicating pay-per-use.

Default: postPaid

is_auto_pay

No

String

|-

period_type

No

String

|-

period_num

No

Integer

|-

Table 4 BackupPolicy

Parameter

Mandatory

Type

Description

backup_type

Yes

String

Backup type.

  • auto: automatic backup

  • manual: manual backup

save_days

No

Integer

This parameter is mandatory when backup_type is set to auto. Retention period, in days. The value ranges from 1 to 7.

periodical_backup_plan

No

BackupPlan object

Backup schedule. This parameter is mandatory when backup_type is set to auto.

Table 5 BackupPlan

Parameter

Mandatory

Type

Description

timezone_offset

No

String

Time zone in which backup is performed. 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.

backup_at

Yes

Array of integers

Day in a week on which backup starts. The value ranges from 1 to 7, where 1 indicates Monday, and 7 indicates Sunday.

period_type

Yes

String

Interval at which backup is performed, which supports only weekly currently.

begin_at

Yes

String

Time at which backup starts. 00:00-01:00 indicates that the backup starts at 00:00. The value must be on the hour. The backup interval is 1 hour.

Table 6 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

  • This field cannot be left blank.

  • The key value of a resource must be unique.

  • The tag key can contain a maximum of 36 characters.

  • The tag key must be unique and cannot be empty.

value

No

String

Tag value.

  • This parameter is mandatory when action is set to create and is optional when action is set to delete.

  • The tag value can contain a maximum of 43 characters.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

instances

Array of Instances objects

DCS instance ID and name. If multiple DCS instances are created at a time, multiple DCS instance IDs and names will be returned.

Table 8 Instances

Parameter

Type

Description

instance_id

String

DCS instance ID.

instance_name

String

DCS instance name.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 404

Table 12 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 500

Table 13 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Example Requests

  • Creating a DCS Redis instance

    POST https://{dcs_endpoint}/v2/{project_id}/instances
    
    {
      "name" : "dcs-APITest",
      "description" : "Test",
      "engine" : "Redis",
      "engine_version" : "5.0",
      "enterprise_project_id" : 0,
      "enterprise_project_name" : "default",
      "vpc_id" : "5e37b3be-950a-48e1-b498-65b63d336481",
      "security_group_id" : "securityGroupId",
      "enable_ssl" : false,
      "private_ip" : "",
      "az_codes" : [ "region01" ],
      "capacity" : 1,
      "access_user" : "",
      "password" : "********",
      "enable_publicip" : false,
      "spec_code" : "redis.single.xu1.large.1",
      "subnet_id" : "a4112635-3ec0-471c-95c3-5cf49b9533af",
      "no_password_access" : false,
      "template_id" : "b3ecc9c7-1133-4c47-a06a-21366e227d61"
    }
  • Creating a pay-per-use, master/standby DCS Redis instance with a customized port, renamed commands, and cross-AZ deployment

    {
      "enterprise_project_name" : "default",
      "vpc_id" : "c5cd009b-9ba9-41f2-9a26-2b8c3f3ffd39",
      "description" : "Test",
      "security_group_id" : "d57fad27-e3e9-43b7-9498-0a698ab63b27",
      "port" : 4040,
      "enable_ssl" : false,
      "private_ip" : "",
      "az_codes" : [ "region01", "region02" ],
      "capacity" : 2,
      "access_user" : "",
      "instance_num" : 1,
      "enterprise_project_id" : 0,
      "password" : "********",
      "enable_publicip" : false,
      "engine" : "Redis",
      "spec_code" : "redis.ha.au1.large.2",
      "name" : "dcs-demo",
      "subnet_id" : "7e95c4d6-d7af-424c-a3cf-2be10968fe81",
      "engine_version" : "4.0",
      "no_password_access" : false,
      "rename_commands" : {
        "keys" : "keys001",
        "flushdb" : "flushdb001",
        "flushall" : "flushall001"
      }
    }

Example Responses

Status code: 200

The DCS instance creation task is submitted successfully.

NOTE:

If the instance status is RUNNING, the DCS instance has been successfully created.

  • Example 1

    {
      "instances" : [ {
        "instance_id" : "3c49fd6b-fc7c-419e-9644-b6cce008653f",
        "instance_name" : "dcs-test005"
      } ]
    }
  • Example 2

    {
      "instances" : [ {
        "instance_id" : "77284d69-cd51-4bf1-aa30-2e60f055800c",
        "instance_name" : "dcs-APITest1"
      } ]
    }

Status code: 400

Invalid request.

{
  "error_code" : "DCS.1004",
  "error_msg" : "Project ID does not match the token."
}

Status code: 401

Invalid authentication information.

{
  "error_code" : "DCS.1001",
  "error_msg" : "Invalid token."
}

Status code: 403

The request is rejected.

{
  "error_code" : "DCS.2003",
  "error_msg" : "This role does not have the permission to perform this operation."
}

Status code: 404

The requested resource is not found.

{
  "error_code" : "DCS.4001",
  "error_msg" : "The requested URL does not exist."
}

Status code: 500

Internal service error.

{
  "error_code" : "DCS.5000",
  "error_msg" : "Internal service error."
}

Status Codes

Status Code

Description

200

The DCS instance creation task is submitted successfully.

NOTE:

If the instance status is RUNNING, the DCS instance has been successfully created.

400

Invalid request.

401

Invalid authentication information.

403

The request is rejected.

404

The requested resource is not found.

500

Internal service error.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback