You can call this operation to create a read-only instance for an RDS instance.

This operation must meet the following requirements:

  • The master instance must use one of the following database engine versions or editions:
    • MySQL 5.6
    • MySQL 5.7/8.0 High-availability Edition (based on local SSDs)
    • SQL Server 2017 Cluster Edition
  • For MySQL instances:
    • If the memory of the master instance is greater than or equal to 64 GB, the master instance can have up to 10 read-only instances.
    • If the memory of the master instance is less than 64 GB, the master instance can have up to five read-only instances.
  • For SQL Server instances, the master instance can have up to seven read-only instances.

Debugging

You can use OpenAPI Explorer to perform debugging. OpenAPI Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateReadOnlyDBInstance

The operation that you want to perform. Set this parameter to CreateReadOnlyDBInstance.

RegionId String Yes cn-hangzhou

The ID of the region. The read-only instance and the master instance must be in the same region. You can call the DescribeRegions API operation to view the latest regions.

ZoneId String Yes cn-hangzhou-b

The ID of the zone. You can call the DescribeRegions API operation to view the latest zones.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the master instance.

DBInstanceClass String Yes rds.mys2.small

The type of the instance. For more information, see Instance type list. The type of the read-only instance must be no less than that of the master instance. Otherwise, the read-only instance incurs high latency and high load.

DBInstanceStorage Integer Yes 20

The storage space of the instance. Value range: 5 to 3000. The value must be a multiple of 5. Unit: GB.

Note Instances of different versions have different value ranges. For more information, see the read-only instance creation page in the console.
EngineVersion String Yes 5.6

The version of the database. The database and the master instance must have the same database version. Valid values:

  • 5.6
  • 5.7
  • 8.0
  • 2017_ent
PayType String Yes Postpaid

The billing method. The system only supports Pay-As-You-Go. Valid value: Postpaid.

DBInstanceDescription String No Read-only instance for test

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

Note It cannot start with http:// or https://.
ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxxxxx

The client token that is used to guarantee the idempotency of requests. The client token is generated by the client and is unique among different requests. It is a string of up to 64 ASCII characters.

InstanceNetworkType String No Classic

The network type of the instance. Valid values:

  • VPC
  • Classic

Default value: Classic.

VPCId String No vpc-uf6f7l4fg90xxxxxxxxxx

The ID of the VPC.

VSwitchId String No vsw-uf6adz52c2pxxxxxxxxxx

The ID of the VSwitch.

AccessKeyId String No LTAIfCxxxxxxxxxx

The AccessKey ID that Alibaba Cloud issues to a user for service access.

PrivateIpAddress String No 172.16.201.69

The private IP address of the read-only instance. It must be within the IP address range provided by the switch. The system automatically assigns an IP address based on the VPCId and VSwitchId by default.

ResourceGroupId String No rg-acfmyxxxxxxxxxx

The ID of the resource group.

DBInstanceStorageType String No local_ssd

The storage type of the instance. Valid values:

  • local_ssd/ephemeral_ssd: local SSDs.
  • cloud_ssd: SSDs.
  • cloud_essd: ESSDs.
Note The MySQL database engine supports only local SSDs and the SQL Server database engine supports only SSDs.
Category String No HighAvailability

The edition of the instance. Valid values:

  • Basic
  • HighAvailability
  • AlwaysOn

Response parameters

Parameter Type Example Description
DBInstanceId String rr-uf6wjk5xxxxxxx

The ID of the read-only instance.

OrderId String 10078937xxxxx

The ID of the order.

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

The endpoint URL of the read-only instance.

Port String 3306

The internal port of the read-only instance.

RequestId String 1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC

The ID of the request.

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>

Successful response examples

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

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

Error codes

HTTP status code Error code Error message Description
400 InvalidEngineVersion.Malformed The specified parameter "EngineVersion" is not valid. The error message returned when the specified EngineVersion parameter is invalid.
400 InvalidSecurityIPList.Malformed The specified parameter "SecurityIPList" is not valid. The error message returned when the specified SecurityIPList parameter is invalid.
400 InvalidSecurityIPList.Duplicate The Security IP address is not in the available range or occupied. The error message returned when the specified security IP address is in use or is not in the valid range.
400 InvalidParameter The specified parameter "dbInstanceId" is not valid. The error message returned when the specified dbInstanceId parameter is invalid.
403 OperationDenied.PrimaryDBInstanceStatus The operation is not permitted due to status of primary instance. The error message returned when the status of the master instance does not support this operation. Only the master instance in the running state supports this operation.
400 OperationDenied VPC IP is in use, please check. The error message returned when the specified IP address is in use. Change the IP address and try.
404 IncorrectDBInstanceConnType Current DB instance conn type does not support this operation. The error message returned when the connection type of the DB instance does not support this operation.
400 InvalidZoneId.NotSupported The Specified vpc Zone not supported. The error message returned when the zone does not support the VPC instance. Change the zone and try.

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