Restores an original ApsaraDB for RDS instance to a new instance, which is called a clone instance.

Before you call this operation, make sure that the following requirements are met:

  • The original instance is in the Running state.
  • All migration tasks on the original instance are completed or stopped.
  • The original instance has log backup enabled to support point-in-time recovery (PITR).
  • If you want to clone the original instance by using a data backup file, the instance has at least one data backup file.
    Note ApsaraDB for RDS allows you to create a clone instance by using the credentials of your RAM user. Make sure that your RAM user is granted the required permissions. For more information, see Use RAM to manage ApsaraDB for RDS permissions.

Take note of the following:

  • The new instance has the same whitelist, SQL Explorer (SQL Audit), alert threshold, backup, and parameter settings as the original instance.
  • The data and account information of the new instance is the same as the information indicated by the data backup file or binary log file of the original instance.

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 CloneDBInstance

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the new instance.

DBInstanceStorageType String Yes cloud_essd

The storage type of the new 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.
PayType String Yes Postpaid

The billing method of the new instance. Valid values:

  • Postpaid: specifies to use pay-as-you-go billing.
  • Prepaid: specifies to use subscription billing.
RegionId String No cn-hangzhou

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

ZoneId String No cn-hangzhou-b

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

DBInstanceClass String No mysql.n1.micro.1

The type of the new instance. For more information, see Primary instance types.

Note The default type is the same as the original instance.
DBInstanceStorage Integer No 1000

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

Note The default storage capacity is the same as the original instance.
DbNames String No testDB

The names of the databases you want to create on the new instance.

InstanceNetworkType String No VPC

The network type of the new instance. Valid values:

  • VPC
  • Classic
Note The default network type is the same as the original instance.
BackupId String No 9026262

The ID of the data backup file you want to use.

You can call the DescribeBackups operation to query the most recent data backup file list.

Note You must specify either the BackupId or RestoreTime parameter.
RestoreTime String No 2011-06-11T16:00:00Z

The point in time to which you want to restore the original instance. The point in time must fall within the log retention period. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note You must specify either the BackupId or RestoreTime parameter.
VPCId String No vpc-uf6f7l4fg90xxxxxxxxxx

The ID of the VPC to which the new 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 private IP address of the new instance. The private IP address must fall within the Classless Inter-Domain Routing (CIDR) block supported by the specified VSwitch. The system automatically assigns an IP address based on the VPCId and VSwitchId parameters.

UsedTime String No 1

The duration of the new instance if the new instance uses 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 when the PayType parameter is set to Prepaid.
Period String No Year

The renewal period of the new instance if the new instance uses subscription billing. Valid values:

  • Year
  • Month
Note This parameter must be specified when the PayType parameter is set to Prepaid.
Category String No HighAvailability

The edition of the 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.
RestoreTable String No 1

Specifies whether to restore tables. Value 1 specifies to restore tables. You can choose not to specify this parameter if you do not want to restore tables.

TableMeta String No [{"type":"db","name":"testdb1","newname":"testdb1_new","tables":[{"type":"table","name":"testdb1table1","newname":"testdb1table1_new"}]}]

The information about the tables you want to restore. Format:

[{"type":"db","name":"The original name of Database 1","newname":"The new name of Database 1","tables":[{"type":"table","name":"The original name of Table 1 in Database 1","newname":"The new name of Table 1 in Database 1"},{"type":"table","name":"The original name of Table 2 in Database 1","newname":"The new name of Table 2 in Database 1"}]},{"type":"db","name":"The original name of Database 2","newname":"The new name of Database 2","tables":[{"type":"table","name":"The original name of Table 1 in Database 2","newname":"The new name of Table 1 in Database 2"},{"type":"table","name":"The original name of Table 2 in Database 2","newname":"The new name of Table 2 in Database 2"}]}]
DedicatedHostGroupId String No dhg-7a9xxxxxxxx

The ID of the host group to which the new instance belongs if you create an instance in a host group.

BackupType String No FullBackup

The type of backup used by the new instance. Valid values:

  • FullBackup
  • IncrementalBackup

Response parameters

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

The ID of the request.

DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the new instance.

OrderId String 100789370xxxxx

The ID of the order.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=CloneDBInstance
&PayType=Postpaid
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&DBInstanceStorageType=cloud_essd
&<Common request parameters>

Sample success responses

XML format

<CloneDBInstanceResponse>
	  <OrderId>100789370xxxxx</OrderId>
	  <DBInstanceId>rm-uf6wjk5xxxxxxx</DBInstanceId>
	  <RequestId>1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC</RequestId></CloneDBInstanceResponse>

JSON format

{
    "OrderId": "100789370xxxxx",
    "DBInstanceId": "rm-uf6wjk5xxxxxxx",
    "RequestId": "1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC"
}

Error codes

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