# Create Slave - CreateUDBSlave

## Overview

Create a slave for UDB instance






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `CreateUDBSlave`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **Zone** | string | Availability Zone. See [Availability Zone List](/docs/api/summary/regionlist) |No|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |No|
| **SrcId** | string | DBId of the master instance, this value can be obtained through DescribeUDBInstance |**Yes**|
| **Name** | string | Instance name, at least 6 characters |**Yes**|
| **Port** | int | Port Number |No|
| **SSDType** | string | Only valid for instances with SSD as the main. Optional values "SATA","NVMe". |No|
| **IsLock** | boolean | Whether to lock the master library, default is true |No|
| **MemoryLimit** | int | Memory Limit (MB), currently supports the following levels 2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M/128000M/192000M/256000M/320000M |No|
| **DiskSpace** | int | Disk Space (GB), temporarily supports 20G - 3000G (API supported, front-end temporarily only supports memory customization) |No|
| **SubnetId** | string | Subnet ID (Use default subnet if not provided) |No|
| **VPCId** | string | VPCID (Use the default VPC if not passed) |No|
| **ChargeType** | string | Year, Month, Dynamic, Trial, Default and keep consistent with the master library |No|
| **Quantity** | int | Purchase duration, by default, is consistent with the main library. |No|
| **ParamGroupId** | int | The ID of the configuration parameter group used by the DB instance, which is kept consistent with the primary database by default. |No|
| **IsCreatePhysically** | boolean | Create a slave library in a physical way, currently only for creating outstanding slave libraries, default is false. |No|
| **DelaySeconds** | int | Set the delay replication duration for the slave database (in seconds) |No|
| **SpecificationType** | int | The type of instance computing specification, 0 or no transmission means purchasing by memory method, 1 means purchasing by optional memory-cpu ratio method, need to fill in MachineType. |No|
| **MachineType** | string | Specification Type ID, valid when SpecificationType is 1 |No|
| **CouponId** | string | ID of the voucher used |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **DBId** | string | Create slave's DBId |No|




## Example

### Request Example
    
```
https://api.scloudsg.com/?Action=CreateUDBSlave 
&Region=cn-bj2
&SrcId=udb-xxxxx
&Name=udb-xxxxxxx-slave
&Port=3306     
&MemoryLimit=4
&DiskSpace=4
&SubnetId=CSKpxQOp
&SubnetId=ICAmjpca
&VPCId=iGLJHujL
&ChargeType=RyAdXrgR
&Quantity=5
&ChargeType=IPwSWCtM
&Quantity=5
&ParamGroupId=4
&IsCreatePhysically=false
&DelaySeconds=6
&UseSSD=true
&SSDType=GnsgKEyT
&SpecificationType=cYBUpmpw
&MachineType=EEMCUisF
```

### Response Example
    
```json
{
  "Action": "CreateUDBSlaveResponse",
  "DBId": "udb-xxxxxx",
  "RetCode": 0
}
```





