You can call the CreateDBInstance operation to create an ApsaraDB for RDS instance.

Before you call this operation, make sure that you fully understand the billing methods and pricing of ApsaraDB for RDS. For more information, visit the ApsaraDB for RDS pricing page.

For more information about the instance types that are supported by ApsaraDB for RDS, see Primary instance types.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateDBInstance

The operation that you want to perform. Set the value to CreateDBInstance.

DBInstanceClass String Yes rds.mysql.s1.small

The instance type that you select. For more information, see Primary instance types.

DBInstanceNetType String Yes Internet

The network connection type of the instance. Valid values:

  • Internet: The instance is connected over the Internet.
  • Intranet: The instance is connected over an internal network.
DBInstanceStorage Integer Yes 20

The storage capacity of the instance. Unit: GB. The storage capacity increases in increments of 5 GB. For more information, see Primary instance types.

Engine String Yes MySQL

The database engine that the instance runs. Valid values:

  • MySQL
  • SQLServer
  • PostgreSQL
  • PPAS
  • MariaDB
EngineVersion String Yes 5.6

The version of the database engine that the instance runs. Valid values:

  • MySQL: 5.5, 5.6, 5.7, and 8.0
  • SQL Server: 2008r2, 08r2_ent_ha, 2012, 2012_ent_ha, 2012_std_ha, 2012_web, 2014_std_ha, 2016_ent_ha, 2016_std_ha, 2016_web, 2017_std_ha, 2017_ent, and 2019_ent
  • PostgreSQL: 9.4, 10.0, 11.0, and 12.0
  • PPAS: 9.3 and 10.0
  • MariaDB: 10.3
PayType String Yes Postpaid

The billing method of the instance. Valid values:

  • Postpaid: The instance uses the pay-as-you-go billing method.
  • Prepaid: The instance uses the subscription method.
RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

SecurityIPList String Yes 10.23.12.27/24

The IP address whitelist of the instance. For more information, see Configure a whitelist for an ApsaraDB RDS for MySQL instance. If the IP address whitelist contains more than one entry, separate them with commas (,). Each IP address whitelist can contain up to 1,000 unique entries. The following two formats are supported:

  • IP addresses, such as 10.23.12.24.
  • Classless Inter-Domain Routing (CIDR) blocks, such as 10.23.12.24/24, where 24 indicates that the prefix of the CIDR block is 24-bit long. You can replace 24 with a value within the range of 1 to 32.
SystemDBCharset String No gbk

The character set that is used by the RDS instance. This parameter has been phased out.

DBInstanceDescription String No testdatabase

The name of the instance. The name must be 2 to 255 characters in length. It can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.

Note The name of the instance cannot start with http:// or https://.
ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxxxxx

The client token that is used to ensure the idempotency of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

ZoneId String No cn-hangzhou-b

The region ID of the primary instance if you create a primary instance.

Note
  • If you specify a VPC and a VSwitch, you must also specify this parameter.
  • If you create an instance that runs the RDS High-availability Edition, you must also specify the ZoneIdSlave1 parameter. This parameter specifies whether to deploy the instance in a single zone or in multiple zones.
  • If you create an instance that runs the RDS Enterprise Edition, you must also specify the ZoneIdSlave1 and ZoneIdSlave2 parameters. These parameters specify whether to deploy the instance in a single zone or in multiple zones.
ZoneIdSlave1 String No cn-hangzhou-c

The region ID of the secondary instance if you create a secondary instance. If you set this parameter to the same value as the ZoneId parameter, the instance is deployed in a single zone. Otherwise, the instance is deployed in multiple zones.

ZoneIdSlave2 String No cn-hangzhou-d

The region ID of the log instance if you create a log instance. If you set this parameter to the same value as the ZoneId parameter, the instance is deployed in a single zone. Otherwise, the instance is deployed in multiple zones.

InstanceNetworkType String No Classic

The network type of the instance. Valid values:

  • VPC
  • Classic

The default network type is Classic.

Note
  • If you create an instance that uses standard or enhanced SSDs, you can set this parameter only to VPC.
  • This parameter must be specified if you create an instance that runs MariaDB.
ConnectionMode String No Standard

The connection mode of the instance. Valid values:

  • Standard: The instance is connected in standard mode.
  • Safe: The instance is connected in database proxy mode.

The system automatically assigns a connection mode.

Note If you create an instance that runs SQL Server 2012, SQL Server 2016, or SQL Server 2017, you can set this parameter only to Standard.
VPCId String No vpc-xxxxxxxxxxxx

The ID of the VPC to which the instance belongs.

Note This parameter must be specified if you create an instance that runs MariaDB.
VSwitchId String No vsw-xxxxxxxxxxx

The ID of the VSwitch associated with the specified VPC. If you specify more than one VSwitch ID, separate them with commas (,).

Note This parameter must be specified if you create an instance that runs MariaDB.
PrivateIpAddress String No 172.16.201.69

The private IP address of the instance. The private IP address must fall within the CIDR block that is supported by the specified VSwitch. The system automatically assigns an IP address based on the specified VPCId and VSwitchId parameters.

UsedTime String No 2

The subscription duration of the instance if you specify to use subscription billing. Valid values:

  • If you set the Period parameter to Year, the value of the UsedTime parameter ranges from 1 to 3.
  • If you set the Period parameter to Month, the value of the UsedTime parameter ranges from 1 to 9.
Note This parameter must be specified if you set the PayType parameter to Prepaid.
Period String No Year

The renewal period of the instance if you specify to use subscription billing. Valid values:

  • Year
  • Month
Note This parameter must be specified if you set the PayType parameter to Prepaid.
ResourceGroupId String No rg-acfmyxxxxxxxxxx

The ID of the resource group to which the instance belongs.

DBInstanceStorageType String No cloud_ssd

The storage type of the instance. Valid values:

  • local_ssd: The instance uses local SSDs. This is the recommended storage type.
  • cloud_ssd: The instance uses standard SSDs.
  • cloud_essd: The instance uses enhanced SSDs.
BusinessInfo String No 121436975448952

The extended business information of the instance.

EncryptionKey String No 0d24xxxx-da7b-4786-b981-9a164dxxxxxx

The ID of the key that is used to encrypt data on the standard and enhanced SSDs in the specified region. You can obtain the ID of the key in the Key Management Service (KMS) console. Alternatively, you can create a key. For more information, see Manage CMKs.

Note If this parameter is specified, disk encryption is enabled and you must also specify the RoleARN parameter. Disk encryption cannot be disabled after it is enabled.
RoleARN String No acs:ram::1406xxxxxx:role/aliyunrdsinstanceencryptiondefaultrole

The Alibaba Cloud Resource Name (ARN) that is provided by your Alibaba Cloud account to the service account of the instance. This ARN is used to connect to KMS. You can copy the ARN from the RAM console.

Note For more information about how to grant the service account the permissions to connect to KMS in the RAM console, see Authorize RDS to access KMS.
AutoRenew String No true

Specifies whether to enable auto-renewal. Valid values: true and false.

Note
  • Monthly subscription: The auto-renewal cycle is one month.
  • Annual subscription: The auto-renewal cycle is one year.
Category String No HighAvailability

The RDS edition of the instance. Valid values:

  • Basic: The instance runs the Basic Edition.
  • HighAvailability: The instance runs the High-availability Edition.
  • AlwaysOn: The instance runs the Cluster Edition.
  • Finance: The instance runs the Enterprise Edition.
DedicatedHostGroupId String No dhg-4nxxxxxxx

The ID of the dedicated cluster to which the instance belongs if you create an instance in a dedicated cluster.

TargetDedicatedHostIdForMaster String No i-bpxxxxxxx1

The ID of the host to which the instance belongs if you create a primary instance in a dedicated cluster.

TargetDedicatedHostIdForSlave String No i-bpxxxxxxx2

The ID of the host to which the instance belongs if you create a secondary instance in a dedicated cluster.

TargetDedicatedHostIdForLog String No i-bpxxxxxxx3

The ID of the host to which the instance belongs if you create a log instance in a dedicated cluster.

Note This parameter is not supported.
DBParamGroupId String No rpg-sys-xxxx

The ID of the parameter template that is used by the instance.

DBTimeZone String No +08:00

The UTC time zone of the instance. Valid values: -12:59 to +13:00.

Note
  • If you do not specify this parameter, the system assigns the default time zone of the region to which the instance belongs.
  • If you create an instance that uses local SSDs, you can name the time zone, for example, Asia/Hongkong. For more information, see the official documentation of each database engine.
DBIsIgnoreCase String No 1

Specifies whether table names are case-sensitive on the instance. Valid values:

  • 1: Table names are not case-sensitive. This is the default value.
  • 0: Table names are case-sensitive.
TargetMinorVersion String No rds_20200229

The minor engine version of the instance if you create an instance that runs MySQL. Format: RDS edition_Minor engine version. Examples: rds_20200229, xcluster_20200229, and xcluster80_20200229.

  • rds: The instance runs the RDS High-availability or Basic Edition.
  • xcluster: The instance runs MySQL 5.7 on RDS Enterprise Edition.
  • xcluster80: The instance runs MySQL 8.0 on RDS Enterprise Edition.
Note For more information about the minor engine versions, see Release Notes of Minor AliSQL Versions.
StorageAutoScale String No Disable

Specifies to enable or disable the automatic storage capacity scaling function. Valid values:

  • Enable
  • Disable
StorageThreshold Integer No 50

The threshold based on which to trigger automatic storage capacity scaling. Unit: %. Valid values:

  • 10
  • 20
  • 30
  • 40
  • 50
Note This parameter must be specified if you set the StorageAutoScale parameter to Enable.
StorageUpperBound Integer No 2000

The maximum storage capacity that is allowed by the automatic storage capacity scaling function. Unit: GB. Valid values: an integer greater than or equal to 0.

Note This parameter must be specified if you set the StorageAutoScale parameter to Enable.

Response parameters

Parameter Type Example Description
DBInstanceId String rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

OrderId String 1007893702xxxxx

The ID of the order.

ConnectionString String rm-uf6wjk5xxxxxxx.mysql.rds.aliyuncs.com

The endpoint that is used to connect to the instance.

Note The DBInstanceNetType parameter specifies whether the endpoint is internal or public.
Port String 3306

The port that is used to connect to the instance.

Note The DBInstanceNetType parameter specifies whether the port is internal or public.
RequestId String 1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=CreateDBInstance
&RegionId=cn-hangzhou
&Engine=MySQL
&EngineVersion=5.6
&DBInstanceClass=rds.mysql.s1.small
&DBInstanceStorage=20
&DBInstanceNetType=Internet
&PayType=Postpaid
&SecurityIPList=10.23.12.27/24
&<Common request parameters>

Sample success responses

XML format

<CreateDBInstanceResponse>
      <OrderId>1007893702xxxxx</OrderId>
      <ConnectionString>rm-uf6wjk5xxxxxxx.mysql.rds.aliyuncs.com</ConnectionString>
      <DBInstanceId>rm-uf6wjk5xxxxxxx</DBInstanceId>
      <Port>3306</Port>
      <RequestId>1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC</RequestId>
</CreateDBInstanceResponse>

JSON format

{
    "OrderId": "1007893702xxxxx",
    "ConnectionString": "rm-uf6wjk5xxxxxxx.mysql.rds.aliyuncs.com",
    "DBInstanceId": "rm-uf6wjk5xxxxxxx",
    "Port": "3306",
    "RequestId": "1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidZoneId.NotSupported The Specified vpc Zone not supported. The error message returned because the specified zone does not support the VPC network type. Change the zone and try again.
400 InvalidPaymentMethod.Incomplete No payment method is specified for your account. We recommend that you add a payment method. The error message returned because your Alibaba Cloud account does not have a valid payment method. Add a valid payment method and try again.
400 InvalidPaymentMethod.Missing No payment method is specified for your account. We recommend that you add a payment method. The error message returned because your Alibaba Cloud account does not have a valid payment method. Add a valid payment method and try again.
400 SYSTEM.CONCURRENT_OPERATE Concurrent operation is detected. The error message returned because the system runs concurrent operations in parallel.

For a list of error codes, visit the API Error Center.