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 2024-11-26 GMT+08:00

Function

This API is used to create a DCS instance.

URI

POST /v1.0/{project_id}/instances

Table 1 describes the parameter.
Table 1 Parameter description

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.

Table 2 Parameter description

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. Options: 4.0 and 5.0.

NOTE:

DCS Redis 3.0 instances are no longer sold at new sites since the current version. The value can only be 4.0/5.0. Redis 3.0 can still be used at existing sites, but Redis 4.0 and later are recommended.

spec_code

String

Yes

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.

For details about the specification codes, see the Specification Code (spec_code in the API) column in the "DCS Instance Specifications" section in Distributed Cache Service User Guide.

capacity

Float

Yes

Cache capacity. Unit: GB.

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

password

String

Yes

Password of a DCS instance.

The password of a DCS Redis instance must meet the following complexity requirements:

  • Must be a string consisting of 8 to 64 characters.
  • Must be different from the old password.
  • Contains at least three of the following character types:
    • Lowercase letters
    • Uppercase letters
    • Digits
    • Special characters (`~!@#$^&*()-_=+\|{},<.>/?)

vpc_id

String

Yes

VPC ID.

Obtain the value by using either of the following methods:

  • Method 1: Log in to VPC console and view the VPC ID in the VPC details.
  • Method 2: Call the API for querying VPCs. For details, see the "Querying VPCs" section in the Virtual Private Cloud API Reference.

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 access control by security groups.

Redis 4.0 and later instances do not support access control by security groups.

Obtain the value by using either of the following methods:

  • 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 for querying security groups. For details, see the "Querying Security Groups" section in the Virtual Private Cloud API Reference.

subnet_id

String

Yes

Network ID of the subnet.

Obtain the value by using either of the following methods:

  • 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 API for querying subnets. For details, see the "Querying Subnets" section in the Virtual Private Cloud API Reference.

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.

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.

maintain_begin

String

No

Time at which the maintenance time window starts.

Format: hh:mm:ss.

  • The start time and end time of the maintenance time window must indicate the time segment of a supported maintenance time window. For details on how to query the time segments of supported maintenance time windows, see Querying Maintenance Time Window.
  • The start time must be set to 22:00:00, 02:00:00, 06:00:00, 10:00:00, 14:00:00, or 18:00: 00.
  • Parameters maintain_begin and maintain_end must be set in pairs. If parameter maintain_start is left blank, parameter maintain_end is also blank. In this case, the system automatically set the start time to 02:00:00.

maintain_end

String

No

Time at which the maintenance time window ends.

Format: hh:mm:ss.

  • The start time and end time of the maintenance time window must indicate the time segment of a supported maintenance time window. For details on how to query the time segments of supported maintenance time windows, see Querying Maintenance Time Window.
  • The end time is four hours later than the start time. For example, if the start time is 22:00:00, the end time is 02:00:00.
  • Parameters maintain_begin and maintain_end must be set in pairs. If parameter maintain_end is left blank, parameter maintain_start is also blank. In this case, the system automatically set the end time to 06:00:00.

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.

Table 3 instance_backup_policy parameter description

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:

  • auto: automatic backup.
  • manual: manual backup.

The default value is manual.

periodical_backup_plan

Object

Yes

Backup plan. For details, see Table 4.

Table 4 periodical_backup_plan parameter description

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:
    {
        "name": "dcs-a11e",
        "description": "Create an instance",
        "engine": "Redis",
        "engine_version": "3.0",
        "capacity": 2,
        "spec_code": "XXXXXX",
        "password": "XXXXXX",
        "vpc_id": "27d99e17-42f2-4751-818f-5c8c6c03ff15",
        "security_group_id": "1477393a-29c9-4de5-843f-18ef51257c7e",
        "subnet_id": "ec2f34b9-20eb-4872-85bd-bea9fc943128",
        "available_zones": ["ae04cf9d61544df3806a3feeb401b204","d573142f24894ef3bd3664de068b44b0"],
        "product_id": "XXXXXX",
        "instance_backup_policy": {
            "save_days": 1,
            "backup_type": "auto",
            "periodical_backup_plan": {
                "begin_at": "00:00-01:00",
                "period_type": "weekly",
                "backup_at": [
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7
                ]
            }
        },
        "maintain_begin": "22:00:00",
        "maintain_end": "02:00:00"
    }

Response

Response parameters

Table 5 describes the response parameters.
Table 5 Parameter description

Parameter

Type

Description

instance_id

String

DCS instance ID.

instances

Array of Objects

DCS instance list. For details, see Table 6.

Table 6 instances parameters

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-demo"
        }
    ],
    "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.

Table 7 Status code

Status Code

Description

200

DCS instance created successfully.

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