# create mysql instance - CreateUDBMySQLInstance

## Overview

Create UDB instances (including creating MySQL NVMe, shared, and O2 instances as well as restoring instances from backups)

 > 💡 Create a highly available cross-AZ parameter group:  1. The parameter BackupZone is required, with the value being the ZoneId for high availability disaster recovery.  2. The parameter ParamGroupId: the value is the cross-AZ configuration file, which can be obtained via DescribeUDBParamGroup




## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `CreateUDBMySQLInstance`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.sigcalcloud.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) |**Yes**|
| **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|
| **Name** | string | Instance name, at least 6 characters |**Yes**|
| **AdminPassword** | string | Administrator Password |**Yes**|
| **DBTypeId** | string | DB type, mysql/mongodb/postgesql/sqlserver subdivided by version mysql-8.4, mysql-8.0, mysql-5.5, percona-5.5, mysql-5.6, percona-5.6, mysql-5.7, percona-5.7, |**Yes**|
| **Port** | int | Port number, mysql default 3306 |**Yes**|
| **DiskSpace** | int | Disk Space (GB), temporarily supports 20G - 32T |**Yes**|
| **ParamGroupId** | int | Configuration parameter group id used by the DB instance |**Yes**|
| **MachineType** | string | Specification type ID. This field is valid only when SpecificationType = 1. Please retrieve the value through the ListUDBMachineType API. |**Yes**|
| **StorageClass** | string | Storage Type CLOUD_SSD: SSD Cloud Disk, CLOUD_RSSD: RSSD Cloud Disk, CLOUD_SSD_ESSENTIAL: SSD Essential Cloud Disk. This field combined with SpecificationClass has a higher priority than the InstanceType field. |**Yes**|
| **SpecificationClass** | string | Specification Type O: NVME, OM: Shared Type, N: General Type |**Yes**|
| **ChargeType** | string | Yearly, Monthly, Dynamic, Trial, Default: Monthly |No|
| **Quantity** | int | Purchase duration, default value 1 |No|
| **BackupCount** | int | Backup strategy, number of backups per week, default is 7 times |No|
| **BackupTime** | int | Backup strategy, backup start time, calculated in units of hours, default is 1 o'clock |No|
| **BackupDuration** | int | Backup strategy, backup time interval, calculated in hours, default is 24 hours. |No|
| **BackupId** | int | Backup ID, if specified, it means to restore the instance from the backup. |No|
| **InstanceMode** | string | UDB instance mode type, optional values are as follows: "Normal": Standard version UDB instance "HA": High availability version UDB instance The default is "Normal". |No|
| **BackupZone** | string | The availability zone where the cross-availability zone high-availability backup library is located, see [Availability Zone List](/docs/api/summary/regionlist) |No|
| **SubnetId** | string | Subnet ID |No|
| **VPCId** | string | ID of VPC |No|
| **DisableSemisync** | boolean | Whether to enable asynchronous high availability, not filled by default, can be set to true |No|
| **Tag** | string | The name of the business group where the instance is located |No|
| **DBSubVersion** | string | MySQL minor version. Specifying a minor version during instance creation is supported. Please use the DescribeUDBType API to obtain the available versions. |No|
| **CaseSensitivityParam** | int | MySQL case sensitivity parameter, 0 for case sensitive, 1 for case insensitive, currently only effective for MySQL 8.0 |No|
| **AlarmTemplateId** | string | ID of the alarm template |No|
| **BackupURL** | string | Internal network address for downloading backup files from US3 |No|
| **SemisyncFlag** | int | Semi-synchronous toggle switch: 1 indicates enabling semi-synchronous, 2 indicates disabling semi-synchronous, 0 indicates the default value, which is also enabling semi-synchronous by default. |No|
| **Labels.N.Key** | string | Keys of User Resource Label |No|
| **Labels.N.Value** | string | Values of User Resource Label |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 | BD Instance ID |No|




## Example

### Request Example
    
```
https://api.sigcalcloud.com/?Action=CreateUDBMySQLInstance
&Region=DHSQjnMH
&Zone=VPbfMFgr
&ProjectId=QqMPIElo
&Name=VJRdgjLz
&AdminPassword=qpuNzHWu
&DBTypeId=mysql-5.7
&Port=1
&DiskSpace=2
&ParamGroupId=1
&SpecificationType=BSzvvsmr
&MachineType=vVzRuiXW
&StorageClass=iFbCPKNS
&SpecificationClass=VyvAhzBv
&ChargeType=fBuCAPrS
&Quantity=7
&AdminUser=BrxrNMhG
&BackupCount=8
&BackupTime=6
&BackupDuration=5
&BackupId=8
&InstanceMode=Normal
&BackupZone=rFyctFJb
&SubnetId=daZLUdLl
&VPCId=hHzobfnk
&DisableSemisync=true
&Tag=fEWwwrJs
&DBSubVersion=8.0.16
&CaseSensitivityParam=6
&AlarmTemplateId=msYGzxTY
&BackupURL=jbeGhHuy
&SemisyncFlag=3
&Labels.N.Key=ZSDypLJv
&Labels.N.Value=VZexUEuN
&CouponId=XasoJFsT
```

### Response Example
    
```json
{
  "Action": "CreateUDBMySQLInstanceResponse",
  "DBId": "JhdlRKKq",
  "RetCode": 0
}
```





