Creates a read-only instance for a primary ApsaraDB for RDS instance.

Before you call this operation, note the following information:
  • The primary instance must run one of the following database engine versions or RDS editions:
    • MySQL 5.6
    • MySQL 5.7 or 8.0 in the High-availability Edition (with local SSDs)
    • SQL Server 2017 in the Cluster Edition
  • If the primary instance is running MySQL:
    • If the memory capacity of the primary instance is greater than or equal to 64 GB, up to 10 read-only instances are allowed.
    • If the memory capacity of the primary instance is less than 64 GB, up to five read-only instances are allowed.
  • If the primary instance is running SQL Server, up to seven read-only instances are allowed.

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 CreateReadOnlyDBInstance

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

DBInstanceClass String Yes rds.mys2.small

The type of the read-only instance. For more information, see Primary instance types. We recommend that the specifications of the read-only instance be greater than or equal to the specifications of the primary instance. If the specifications of the read-only instance are lower than the specifications of the primary instance, the read-only instance may encounter high latency or heavy load issues.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the primary instance.

DBInstanceStorage Integer Yes 20

The storage capacity of the read-only instance. Valid values: 5 to 3000. Unit: GB. The value of this parameter must be a multiple of 5.

Note The storage capacity range available varies based on the RDS edition. For more information, go to the ApsaraDB for RDS console.
EngineVersion String Yes 5.6

The database engine version that you want the read-only instance to run. The read-only instance must run the same database engine version as the primary instance.

  • If the read-only instance runs MySQL, set this parameter to one of the following three values:
    • 5.6
    • 5.7
    • 8.0
  • If the read-only instance runs SQL Server, set the value to 2017_ent.
PayType String Yes Postpaid

The billing method of the read-only instance. Only the pay-as-you-go billing method is supported. Valid value: Postpaid.

RegionId String Yes cn-hangzhou

The ID of the region to which the read-only instance belongs. The read-only instance must reside in the same region as the primary instance. You can call the DescribeRegions operation to query the most recent region list.

ZoneId String Yes cn-hangzhou-b

The ID of the zone to which the read-only instance belongs. You can call the DescribeRegions operation to query the most recent zone list.

ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxxxxx

The client token that is used to ensure the idempotence 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.

DBInstanceDescription String No Read-only instance for test

The description of the read-only instance. The description must be 2 to 256 characters in length. It can contain letters, digits, underscores (_), and hyphens (-).

Note It must start with a letter, but cannot start with http:// or https://.
InstanceNetworkType String No Classic

The network type of the read-only instance. Valid values:

  • VPC
  • Classic

The default network type is VPC. If you set this parameter to VPC, you must also specify the VPCId and VSwitchId parameters.

VPCId String No vpc-uf6f7l4fg90xxxxxxxxxx

The ID of the VPC to which the read-only instance belongs.

VSwitchId String No vsw-uf6adz52c2pxxxxxxxxxx

The ID of the VSwitch associated with the specified VPC.

PrivateIpAddress String No 172.16.201.69

The internal IP address of the read-only instance. The internal IP address must be within the Classless Inter-Domain Routing (CIDR) block that is supported by the specified VSwitch. The system automatically assigns an internal IP address based on the VPCId and VSwitchId parameters.

ResourceGroupId String No rg-acfmyxxxxxxxxxx

The ID of the resource group to which the read-only instance belongs.

Category String No HighAvailability

The RDS edition of the read-only instance. Valid values:

  • Basic: specifies to use the Basic Edition.
  • HighAvailability: specifies to use the High-availability Edition.
  • AlwaysOn: specifies to use the Cluster Edition.
  • Finance: specifies to use the Enterprise Edition.
DBInstanceStorageType String No local_ssd

The storage type of the read-only instance. Valid values:

  • local_ssd or ephemeral_ssd: specifies to use local SSDs.
  • cloud_ssd: specifies to use standard SSDs.
  • cloud_essd: specifies to use enhanced SSDs.
Note MySQL only supports local SSDs. SQL Server supports both standard and enhanced SSDs.

Response parameters

Parameter Type Example Description
RequestId String 1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC

The ID of the request.

DBInstanceId String rr-uf6wjk5xxxxxxx

The ID of the read-only instance.

OrderId String 10078937xxxxx

The ID of the purchase order.

ConnectionString String rr-xxxxx.mysql.rds.aliyuncs.com

The internal endpoint of the read-only instance.

Port String 3306

The internal port of the read-only instance.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=CreateReadOnlyDBInstance
&RegionId=cn-hangzhou
&ZoneId=cn-hangzhou-b
&DBInstanceId=rm-uf6wjk5xxxxxxx
&DBInstanceClass=rds.mys2.small
&DBInstanceStorage=20
&EngineVersion=5.6
&PayType=Postpaid
&<Common request parameters>

Sample success responses

XML format

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

JSON format

{
    "OrderId": "10078937xxxxx",
    "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 InvalidEngineVersion.Malformed The specified parameter "EngineVersion" is not valid. The error message returned because the specified EngineVersion is invalid.
400 InvalidSecurityIPList.Malformed The specified parameter "SecurityIPList" is not valid. The error message returned because the specified SecurityIPList is invalid.
400 InvalidSecurityIPList.Duplicate The Security IP address is not in the available range or occupied. The error message returned because the specified internal IP address is in use or is not within the CIDR block that is supported by the specified VSwitch.
400 InvalidParameter The specified parameter "dbInstanceId" is not valid. The error message returned because the specified DBInstanceId is invalid.
403 OperationDenied.PrimaryDBInstanceStatus The operation is not permitted due to status of primary instance. The error message returned because the primary instance is in a state that does support this operation. This operation is supported only when the primary instance is in the Running state.
400 OperationDenied VPC IP is in use, please check. The error message returned because the specified internal IP address is in use. Change the internal IP address and try again.
404 IncorrectDBInstanceConnType Current DB instance conn type does not support this operation. The error message returned because the connection type of the primary instance does not support this operation.
400 InvalidZoneId.NotSupported The Specified vpc Zone not supported. The error message returned because the specified zone does not support instances that reside in VPCs. Change the zone and try again.

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