You can call the CreateDdrInstance operation to restore the data of an ApsaraDB RDS instance to a new ApsaraDB RDS instance that resides in a different region.

Before you call this operation, you can call the CheckCreateDdrDBInstance operation to check whether the data of the source instance can be restored from a cross-region data backup file.

Before you call this operation, make sure that the source instance runs one of the following database engines:

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 CreateDdrInstance

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

DBInstanceClass String Yes rds.mysql.s1.small

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

DBInstanceNetType String Yes Intranet

The network connection type of the destination instance. Valid values:

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

The storage capacity of the destination instance. Valid values: 5 to 2000. Unit: GB.

The storage capacity increases at increments of 5 GB. For more information, see Primary instance types.

Engine String Yes MySQL

The database engine that is run on the destination instance. Valid values:

  • MySQL
  • SQLServer
  • PostgreSQL
EngineVersion String Yes 5.6

The version of the database engine that is run on the destination instance. The value of this parameter varies based on the value of the Engine parameter. 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, 2019_std_ha, and 2019_ent
  • PostgreSQL: 9.4, 10.0, 11.0, 12.0, and 13.0
PayType String Yes Prepaid

The billing method of the destination instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
RegionId String Yes cn-hangzhou

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

RestoreType String Yes 0

The restoration method that you want to use. Valid values:

  • 0: restores data from a data backup file. If you select this value, you must also specify the BackupSetId parameter.
  • 1: restores data to a point in time. If you select this value,you must also specify the RestoreTime, SourceRegion, and SourceDBInstanceName parameters.
SecurityIPList String Yes 127.0.0.1

The IP address whitelist that you want to configure for the destination instance. If the IP address whitelist contains more than one entry, you must separate these entries with commas (,). Each entry must be unique. A maximum of 1,000 entries are allowed. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for MySQL instance. The entries in the IP address whitelist support the following two formats:

  • IP address. Example: 10.23.12.24.
  • CIDR block. Example:10.23.12.24/24, where 24 indicates that the prefix of each IP address is 24 bits in length. You can replace 24 with a value that ranges from 1 to 32.
SystemDBCharset String No uft8

The character set that is supported by the destination instance. Valid values:

  • utf8
  • gbk
  • latin1
  • utf8mb4
DBInstanceDescription String No testdatabase

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

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

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

ZoneId String No cn-hangzhou-b

The zone ID of the destination instance. If the destination instance is deployed in multiple zones, you must separate the IDs of these zones with colons (:).

Note If you specify a VPC and a vSwitch, you must also specify this parameter. The specified zones must be supported by the specified vSwitch.
InstanceNetworkType String No Classic

The network type of the destination instance. Valid values:

  • VPC
  • Classic

Default value: Classic.

Note If you set this parameter to VPC, you must also specify the VpcId and VSwitchId parameters.
ConnectionMode String No Standard

The connection mode of the destination instance. Valid values:

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

Default value: Standard.

VPCId String No vpc-xxxxxxxxxxxx

The VPC ID of the destination instance. This parameter is available only when you set the InstanceNetworkType parameter to VPC.

Note If you specify this parameter, you must also specify the ZoneId parameter.
VSwitchId String No vsw-xxxxxxxxxxx

The vSwitch ID of the destination instance. If you specify more than one vSwitch, you must separate the IDs of these vSwitches with commas (,). This parameter is available only when you set the InstanceNetworkType parameter to VPC.

Note If you specify this parameter, you must also specify the ZoneId parameter.
PrivateIpAddress String No 172.16.201.69

The private IP address of the destination instance. The private IP address must be within the CIDR block that is supported by the specified vSwitch. ApsaraDB RDS automatically assigns a private IP address based on the values of the VPCId and VSwitchId parameters.

UsedTime String No 2

The subscription period of the destination instance.

  • 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 If you set the PayType parameter to Prepaid, you must also specify the UsedTime parameter.
Period String No Year

The unit that is used to measure the subscription period of the destination instance. Valid values:

  • Year
  • Month
Note If you set the PayType parameter to Prepaid, you must specify this parameter.
ResourceGroupId String No rg-acfmyxxxxxxxxxx

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

BackupSetId String No 14358

The ID of the data backup file from which you want to restore data. You can call the DescribeCrossRegionBackups operation to query the IDs of the data backup files that are available to an instance.

Note If you set the RestoreType parameter to 0, you must also specify this parameter.
RestoreTime String No 2019-05-30T03:29:10Z

The point in time to which you want to restore data. The specified point in time must be earlier than the current time. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note If you set the RestoreType parameter to 1, you must also specify this parameter.
SourceRegion String No cn-hangzhou

The region ID of the source instance if you want to restore data to a point in time.

Note If you set the RestoreType parameter to 1, you must also specify this parameter.
SourceDBInstanceName String No rm-uf6wjk5xxxxxxx

The ID of the source instance if you want to restore data to a point in time.

Note If you set the RestoreType parameter to 1, you must also specify this parameter.
DBInstanceStorageType String No local_ssd

The type of storage media that is used by the destination instance. Only local SSDs are supported. Default value: local_ssd.

Response parameters

Parameter Type Example Description
DBInstanceId String rm-xxxxx

The ID of the destination instance.

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

The endpoint that is used to connect to the destination instance.

Note The DBInstanceNetType parameter specifies whether the endpoint is an internal endpoint or a public endpoint.
OrderId String 2038691xxxxx

The ID of the order.

Port String 3306

The port number that is used to connect to the destination instance.

Note The DBInstanceNetType parameter specifies whether the port is an internal port or public port.
RequestId String E52666CC-330E-418A-8E5B-A19E3FB42D13

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action==CreateDdrInstance
&RegionId=cn-hangzhou
&Engine=MySQL
&EngineVersion=5.6
&DBInstanceClass=rds.mysql.s1.small
&DBInstanceStorage=20
&DBInstanceNetType=Intranet
&PayType=Prepaid
&RestoreType=0
&SecurityIPList=127.0.0.1
&BackupSetId=14358
&<Common request parameters>

Sample success responses

XML format

<CreateDdrInstanceResponse>
      <RequestId>E52666CC-330E-418A-8E5B-A19E3FB42D13</RequestId>
      <DBInstanceId>rm-xxxxx</DBInstanceId>
      <Port>3306</Port>
      <ConnectionString>rm-xxxxx.mysql.rds.aliyuncs.com</ConnectionString>
      <OrderId>2038691xxxxx</OrderId>
</CreateDdrInstanceResponse>

JSON format

{
	"RequestId": "E52666CC-330E-418A-8E5B-A19E3FB42D13",
	"DBInstanceId": "rm-xxxxx",
	"Port": "3306",
	"ConnectionString": "rm-xxxxx.mysql.rds.aliyuncs.com",
	"OrderId": "2038691xxxxx"
}

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 VPC-hosted instances. Change the zone and try again.
400 InvalidDBInstanceName.Format Specified DB instance name is not valid. The error message returned because the specified instance name is invalid.
400 InvalidRegion.Format Specified Region is not valid. The error message returned because the specified region ID is invalid.
400 InvalidServiceType.Format Specified service type is not valid. The error message returned because the specified service type is invalid.
400 InvalidEngine.Malformed Specified engine is not valid. The error message returned because the specified database engine is invalid.
400 InvalidEngineVersion.Malformed Specified engine version is not valid. The error message returned because the specified database engine version is invalid.
400 InvalidConnectionString.Format Specified connection string is not valid. The error message returned because the specified endpoint is invalid.
400 InvalidConnectionString.Duplicate Specified connection string already exists in the Aliyun RDS. The error message returned because the specified endpoint already exists in ApsaraDB RDS.
400 InvalidCharacterSetName.Format Specified character set name is not valid. The error message returned because the specified character set name is invalid.
400 InvalidDBInstanceType.Format Specified instance type is not valid. The error message returned because the specified instance type is invalid.
400 InvalidPort.Malformed Specified port is not valid. The error message returned because the specified port number is invalid.
400 InvalidPreferredBackupTime.Format Specified preferred backup time is not valid. The error message returned because the specified backup time is invalid.
400 InvalidPreferredBackupPeriod.Malformed Specified backup period is not valid. The error message returned because the specified backup cycle is invalid.
404 InvalidDBInstanceClass.NotFound Specified DB instance class is not found. The error message returned because the specified instance type is invalid. Check that the specified instance type is valid.
404 InvalidDBInstanceNetType.NotFound Specified DB instance net type is not found. The error message returned because the specified network type cannot be found.
400 InvalidOptmizationService Specified optmization service is not valid. The error message returned because an invalid value is specified for the OptmizationService parameter.
400 InvalidExpiredTime.Format Specified expired time is not valid. The error message returned because the specified expiration time is invalid.
400 InvalidSecurityIPList.Format Specified security IP list format is not valid. The error message returned because the specified IP address whitelist is configured in an invalid format.
400 InvalidSecurityIPList.QuotaExceeded Specified security IP list is not valid: Exceeding the allowed amount of IP address in the list. The error message returned because the number of IP addresses and CIDR blocks in the specified IP address whitelist exceeds the upper limit.
400 InvalidDBInstanceDescription.Format Specified DB instance description is not valid. The error message returned because the specified instance description is invalid.
400 InvalidStorage.Format Specified Storage is not valid. The error message returned because invalid values are specified for storage-related parameters.
400 IncorrectDBInstanceType Current DB instance engine and type does not support operations. The error message returned because this operation is not supported for the specified database engine and instance type.
400 InvalidRestoreType.Format Specified restore type is not valid. The error message returned because an invalid value is specified for the RestoreType parameter.
403 IncorrectBackupSetMethod Current backup set method does not support operations. The error message returned because the specified data backup file cannot be used to restore individual databases and tables.
400 InvalidBackupType.Format Specified backup type is not valid. The error message returned because the specified backup type is invalid.
404 InvalidBackupSetID.NotFound Specified backup set ID does not exist. The error message returned because the specified data backup file cannot be found.

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