Baidu AI Cloud
中国站

百度智能云

Distributed Relational Database Service DRDS

Instructions for Instance Management Interfaces

Create an Instance

Interface description

This interface is used to create a DRDS instance.

  • If desired to create a postpaid instance, the account cash balance + general voucher needs to be greater than 100. If desired to create a prepaid instance, the account cash amount needs to be greater than or equal to the instance fee.
  • The interface used to create the instance is an asynchronous interface. You can query the instance status through the “Instance Details” interface.

Request structure

POST /v{version}/instance?clientToken={clientToken} HTTP/1.1
Host: drds.bj.baidubce.com
Authorization: authorization string
{
    "billing":{
        "paymentTiming": paymentTiming,
        "reservation":{
            "reservationLength": reservationLength,
            "reservationTimeUnit": reservationTimeUnit
        } 
    },
    "memoryCapacityInGB": memoryCapacityInGB,
    "volumeCapacityInGB": allocatedStorageInGB,
    "sliceCount": sliceCount,
    "readReplicaCount": readReplicaCount,
    "proxyNodeCount": proxyCount,
    subnets
    {
        "zoneName": zoneName,
        "subnetId": subnetId
    }],
    "vpcId": vpcId 
}

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number
clientToken String Yes Query parameters Means the idempotent Token, which is an ASCII string with a length not exceeding 64 bits.
billing Billing Yes RequestBody parameter Billing-related parameters
memoryCapacityInGB int Yes RequestBody parameter Means the single node memory size, which is expressed in GB and whose optional value includes 8G\16G\32G\48G\64G\128G.
volumeCapacityInGB int Yes RequestBody parameter Means the single node disk size, which is expressed in GB and whose optional value includes 100G\300G\500G\1000G\1500G.
sliceCount int Yes RequestBody parameter Means the number of storage nodes (multiparts), whose optional value includes 2\4\8\16.
readReplicaCount int Yes RequestBody parameter Means the number of read-only nodes in storage nodes (multiparts), whose optional value includes 0\1\2\3\4\5.
proxyNodeCount int Yes RequestBody parameter Means the number of proxy nodes, whose optional value includes 2\4\8\16\32.
subnets List<SubnetMap> No RequestBody parameter Means the subnetId of each availability zone in the vpc. If it is not the default vpc, you must specify a subnetId. You can query the subnet list by calling the query subnet interface.
vpcId string No RequestBody parameter Means the vpc. If not provided, it is the default vpc. You can query the available vpc by calling the Query VPC List interface.

SubnetMap

Parameter Name Type Description
zoneName String Specifies the zone information, which is null by default and is automatically selected by the system. You can query the availability zone list by calling the availability zone list interface. For the ZoneName, the availability zone is named according to the naming convention of "country-region-availability zone sequence", and uses lowercase letters. For example, Beijing availability zone A is "cn-bj-a".
subnetId String If the subnet ID is null, the default subnet is used.

Response header field

There are no other special header fields except for the common header field.

Response parameter

Parameter Name Type Description
instanceIds List<String> Instance ID

Request example

POST https://drds.bj.baidubce.com/v1/instance?clientToken=be31b98c-5e41-4838-9830-9be700de5a20
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

{
    "billing": {
        "paymentTiming": "Postpaid",
        "reservation": {
            "reservationLength": 1,
        }
    },
    "memoryCapacityInGB": 8,
    "volumeCapacityInGB": 100,
    "sliceCount": 1,
    "readReplicaCount": 0,
    "proxyNodeCount": 2,
    "vpcId": "vpc-40252e60cmmc",
    "subnets": [
    {
        "zoneName": "cn-bj-b",
        "subnetId": "sbn-114ia2r9dhkk"
    }],
}

Response example

HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
{
    "instanceIds":["drds-bj-cxisuftlkquj"]
}

Query an Instance List

Interface description

This interface is used to obtain the DRDS instance list.

  • You can only view the instance list of your account.

Request structure

GET /v{version}/instance HTTP/1.1
HOST: drds.bj.baidubce.com
Authorization: authorization string

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number

Response header field

There are no other special header fields except for the common header field.

Response parameter

Parameter Name Type Description
instances List<Instance> DRDS instance list

Instance

Parameter Name Type Description
instanceId String Instance ID
instanceName String Instance name
instanceStatus String Instance status
zoneNames List<String> Availability zone
instanceCreateTime Datetime Instance creation time
region String Region

Request example

GET https://drds.bj.baidubce.com/v1/instance
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

Response example

HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
{
    "instances": [
        {
            "instanceId": "drdsde1upqup698",
            "instanceName": "drds",
            "instanceStatus": "Available",
            "region": "bj",
            "zoneNames": [
                "cn-bj-a"
            ],
            "engine": "mysql",
            "engineVersion": "5.6",
            "instanceCreateTime": "2019-09-21T10:25:41Z"
        },
        {
            "instanceId": "drdsuc6qx3cpnh3",
            "instanceName": "drds",
            "instanceStatus": "Available",
            "region": "bj",
            "zoneNames": [
                "cn-bj-b"
            ],
            "engine": "mysql",
            "engineVersion": "5.6",
            "instanceCreateTime": "2019-09-21T10:24:29Z"
        }
    ]
}

Query Instance Details

Interface description

This interface is used to query the details of the specified instance.

  • You can only view details of the instance in your account.

Request structure

GET /v{version}/instance/{instanceId} HTTP/1.1
HOST: drds.bj.baidubce.com
Authorization: authorization string

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number
instanceId String Yes URI parameter Instance ID

Response header field

There are no other special header fields except for the common header field.

Response parameter

Parameter Name Type Description
instanceId String Instance ID
instanceName String Instance name
instanceStatus String Instance status
region String Region
zoneNames List<String> Availability zone
totalMemoryInMB int Total memory size, unit: MB
totalVolumeInGB int Total disk size, unit: GB
usedVolumeInMB long Used disk size, unit: MB
sliceCount int Number of storage nodes (multiparts)
proxyNodeCount int Number of proxy nodes
vpcId String vpc network ID
instanceCreateTime DateTime Instance creation time
publicAccessStatus String Public network access status
endpoint Endpoint Database connection information
sliceList List<SliceModel> Node information of each multipart
proxyList List<ProxyModel> Proxy node information
paymentTiming String Payment mode, including prepaid, and postpaid modes.
subnets List<Subnet> Subnet information

SliceModel

Parameter Name Type Description
sliceId String Multipart ID
status String Multipart running status
sliceInstances List<SliceInstanceModel> Node information under the multipart

SliceInstanceModel

Parameter Name Type Description
role String Node type, including master, slave, and read-only.
nodeId String Node ID
status String Node status
usedVolumeInMB long Used disk size, unit: MB

Endpoint

Parameter Name Type Description
address String Database connection address (domain name)
port int Database port
vnetIp String IP for connecting to the database
inetIp String IP for connecting to the database from the public network

Public network access status

Parameter Name Description
Closed Public network permission not enabled
Creating Public network is enabling, and the status is Available after success
Available Public network permission is enabled

Request example

GET https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

Response example

HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
{
    "instanceId": "drdsuc6qx3cpnh3",
    "instanceName": "drds",
    "instanceStatus": "Available",
    "region": "bj",
    "engine": "mysql",
    "engineVersion": "5.6",
    "endpoint": {
        "vnetIp": "192.168.0.1",
        "domain": "drds.drdsuc6qx3cpnh3.rds.bj.baidubce.com",
        "port": "3306",
        "inetIp": ""
    },
    "instanceCreateTime": "2019-09-21T10:25:41Z",
    "instanceExpireTime": "2019-10-21T10:29:16Z",
    "publicAccessStatus": "Closed",
    "proxyNodeCount": 2,
    "sliceCount": 1,
    "totalMemoryInMB": 0,
    "totalVolumeInGB": 0,
    "usedVolumeInMB": 4129,
    "paymentTiming": "prepaid",
    "vpcId": "vpc-98p1717te3l",
    "sliceList": [
        {
            "sliceId": "slice5h86w9mv8lh",
            "status": "Available",
            "sliceInstances": [
                {
                    "role": "master",
                    "nodeId": "13e7c910-524f-4174-9d61-571d9d2a9a1f",
                    "status": "Available",
                    "usedVolumeInMB": "4129"
                },
                {
                    "role": "backup",
                    "nodeId": "368518d6-65e8-410c-aeb1-d8d3c0da87d0",
                    "status": "Available",
                    "usedVolumeInMB": "4129"
                }
            ]
        }
    ],
    "proxyList": [
        {
            "proxyId": "proxyyp1jblxtwgi",
            "proxyInstances": [
                {
                    "nodeId": "3e0f6456-044f-4c0f-a95c-04ff43efff21",
                    "status": "Available"
                },
                {
                    "nodeId": "83cdf56e-d861-4b1f-8ce1-665cc7541bf9",
                    "status": "Available"
                }
            ]
        }
    ],
    "zoneNames": [
        "cn-bj-b"
    ],
    "subnets": [
        {
            "name": "System Predefined Subnet B",
            "subnetId": "sbn-8wxqz1wijqj3",
            "zoneName": "cn-bj-b",
            "cidr": "192.168.0.0/20"
        }
    ]
}

Release an Instance

Interface description

This interface is used to release a single cloud database DRDS instance.

Request structure

DELETE /v{version}/instance/{instanceId} HTTP/1.1
HOST: drds.bj.baidubce.com
Authorization authorization string

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number
instanceId String Yes URI parameter Instance ID

Response header field

There are no other special header fields except for the common header field.

Response parameter

No special response parameter

Request example

DELETE https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

Response example

HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json

Modify an Instance Name

Interface description

This interface is used to modify the DRDS instance name

Request structure

PUT /v{version}/instance/{instanceId}?modifyName HTTP/1.1
HOST: drds.bj.baidubce.com
Authorization: authorization string
{
    "name":instanceName
}

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number
instanceId String Yes URI parameter Instance ID
name String Yes RequestBody parameter Means an instance name, which supports uppercase and lowercase letters, numbers, and special characters such as -_/. It must start with a letter and have a length of 1-64 characters.

Response header field

There are no other special header fields except for the common header field.

Response parameter

No special response parameter

Request example

PUT https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
    "name": "instanceName"
}

Response example

HTTP/1.1 200 OK
x-bce-request-id 7869616F-7A68-6977-656E-406261696475
Content-Type application/json

Set Access to the Public Network

Interface description

This interface is used to set the public network access status of a DRDS instance.

Request structure

PUT /v{version}/instance/{instanceId}?modifyPublicAccess HTTP/1.1
HOST: drds.bj.baidubce.com
Authorization authorization string
{
    "publiclyAccessible": publiclyAccessible
}

Request header field

There are no other special header fields except for the common header field.

Request parameters

Parameter Name Type Required? Parameter Position Description
version String Yes URI parameter API version number
instanceId String Yes URI parameter Instance ID
publiclyAccessible String Yes RequestBody parameter True: Enable public network access, false: Disable public network access

Response header field

There are no other special header fields except for the common header field.

Response parameter

No special response parameter

Request example

PUT https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3?modifyPublicAccess
Host: drds.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
    "publiclyAccessible": true
}

Response example

HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
Previous
General Instructions
Next
Instructions for Data Table Management Interfaces