You can call the CreateDdrInstance operation to restore the data of an instance to a new 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 backup file.

Before you call this operation, make sure that the 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.

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.

Engine String Yes MySQL

The database engine of the destination instance. Valid values:

  • MySQL
  • SQLServer
  • PostgreSQL
EngineVersion String Yes 5.6

The major engine version of the destination instance. The value of this parameter varies based on the value of the Engine parameter. Valid values:

  • Valid values when you set the Engine parameter to MySQL: 5.5, 5.6, 5.7, and 8.0
  • Valid values when you set the Engine parameter to 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
  • Valid values when you set the Engine parameter to PostgreSQL: 9.4, 10.0, 11.0, 12.0, and 13.0
DBInstanceClass String Yes rds.mysql.s1.small

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

DBInstanceStorage Integer Yes 20

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

This value must be a multiple of 5 GB. For more information, see Primary ApsaraDB RDS instance types.

SystemDBCharset String No uft8

The character set of the destination instance. Valid values:

  • utf8
  • gbk
  • latin1
  • utf8mb4
DBInstanceNetType String Yes Intranet

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

  • Internet: Internet
  • Intranet: internal network
DBInstanceDescription String No testdatabase

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

Note The name cannot start with http:// or https://.
SecurityIPList String Yes 127.0.0.1

The IP address whitelist of the destination instance. If you want to add more than one entry to the IP address whitelist, separate the entries with commas (,). Each entry must be unique. You can add a maximum of 1,000 entries. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for MySQL instance. The entries in the IP address whitelist must be in one of the following formats:

  • IP address. Example: 10.23.12.24.
  • CIDR block. Example: 10.23.12.24/24. In this example, 24 indicates that the prefix of the CIDR block is 24 bits in length. You can replace 24 with a value that ranges from 1 to 32.
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 token, but you must make sure that the generated token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

PayType String Yes Prepaid

The billing method of the destination instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
ZoneId String No cn-hangzhou-b

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

Note If you specify a virtual private cloud (VPC) and a vSwitch, you must also specify the ZoneId parameter.
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: standard mode
  • Safe: 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, separate the IDs of the 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.XXX.XXX.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. The system automatically assigns a private IP address to an instance based on the values of the VPCId and VSwitchId parameters.

UsedTime String No 2

The subscription duration of the instance. 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 If you set the PayType parameter to Prepaid, you must also specify this parameter.
Period String No Year

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

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

The ID of the resource group.

RestoreType String Yes BackupSet

The method that is used to restore data. Valid values:

  • BackupSet: Data is restored from a backup set. If you use this value, you must also specify the BackupSetID parameter.
  • BackupTime: restores data to a point in time. You must also specify the RestoreTime, SourceRegion, and SourceDBInstanceName parameters.
BackupSetId String No 14***

The ID of the backup set that is used for the restoration. You can call the DescribeCrossRegionBackups operation to query the ID of the backup set.

Note If you set the RestoreType parameter to BackupSet, 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 point in time that you specify 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 BackupTime, 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 BackupTime, 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 BackupTime, you must also specify this parameter.
DBInstanceStorageType String No local_ssd

The storage type of the destination instance. Only the local SSD storage type is supported. Default value: local_ssd.

Response parameters

Parameter Type Example Description
DBInstanceId String rm-xxxxx

The ID of the destination instance.

RequestId String E52666CC-330E-418A-8E5B-A19E3FB42D13

The ID of the request.

Port String 3306

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

Note The DBInstanceNetType parameter indicates whether the port is an internal port or a public port.
ConnectionString String rm-xxxxx.mysql.rds.aliyuncs.com

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

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

The ID of the order.

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
&SystemDBCharset=uft8
&DBInstanceNetType=Intranet
&DBInstanceDescription=testdatabase
&SecurityIPList=127.0.0.1
&ClientToken=ETnLKlblzczshOTUbOCzxxxxxxxxxx
&PayType=Prepaid
&ZoneId=cn-hangzhou-b
&InstanceNetworkType=Classic
&ConnectionMode=Standard
&VPCId=vpc-xxxxxxxxxxxx
&VSwitchId=vsw-xxxxxxxxxxx
&PrivateIpAddress=172.XXX.XXX.69
&UsedTime=2
&Period=Year
&ResourceGroupId=rg-acfmyxxxxxxxxxx	
&RestoreType=BackupSet
&BackupSetId=14***
&RestoreTime=2019-05-30T03:29:10Z
&SourceRegion=cn-hangzhou
&SourceDBInstanceName=rm-uf6wjk5xxxxxxx
&DBInstanceStorageType=local_ssd
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<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

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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 allow you to create an instance in a VPC. Specify a different zone and try again.
400 InvalidDBInstanceName.Format Specified DB instance name is not valid. The error message returned because the instance does not exist. Check the instance information.
400 InvalidDBInstanceName.Duplicate Specified DB instance name already exists in the Aliyun RDS. The error message returned because the instance name already exists. Specify a different name and try again.
400 InvalidRegion.Format Specified Region is not valid. The error message returned because the specified region is invalid.
400 InvalidServiceType.Format Specified service type is not valid. The error message returned because the service type is invalid: Set the service type to 0 or 1. The value 0 indicates an Alibaba Cloud service, and the value 1 indicates a JST service.
400 InvalidEngine.Malformed Specified engine is not valid. The error message returned because the database engine is invalid. Specify a valid database engine.
400 InvalidEngineVersion.Malformed Specified engine version is not valid. The error message returned because the specified database engine version is invalid. Check the database engine version and try again.
400 InvalidConnectionString.Format Specified connection string is not valid. The error message returned because the prefix of the endpoint is invalid. The prefix must be 5 to 40 characters in length.
400 InvalidConnectionString.Duplicate Specified connection string already exists in the Aliyun RDS. The error message returned because the endpoint that you specified already exists. Specify a different endpoint.
400 InvalidCharacterSetName.Format Specified character set name is not valid. The error message returned because the specified character set is invalid. ApsaraDB RDS supports the following character sets: GBK, UTF-8, EUC-KR, and ASCII.
400 InvalidDBInstanceType.Format Specified instance type is not valid. The error message returned because the specified instance type is invalid. Specify a valid instance type.
400 InvalidPort.Malformed Specified port is not valid. The error message returned because the port number that you specified is invalid.
400 InvalidBackupRetentionPeriod.Malformed Specified backup retention period is not valid. The error message returned because the specified backup cycle is invalid. The backup cycle must be greater than 1 day or less than or equal to 30 days.
400 InvalidPreferredBackupTime.Format Specified preferred backup time is not valid. The error message returned because the format of the backup time is incorrect. Specify the time in GMT in the YYYY-MM-DDThh:mmZ format. Example: 2012-06-11T15:00Z.
400 InvalidPreferredBackupPeriod.Malformed Specified backup period is not valid. The error message returned because the backup time is invalid.
400 InvalidExpiredTime.Format Specified expired time is not valid. The error message returned because the value of the ExpiredTime parameter is invalid. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.
400 InvalidSecurityIPList.Format Specified security IP list format is not valid. The error message returned because the IP address whitelist is invalid. Check the IP address whitelist.
400 InvalidSecurityIPList.Duplicate Specified security IP list is not valid: Duplicate IP address in the list The error message returned because the specified IP addresses or CIDR blocks are invalid. The specified IP addresses or CIDR blocks are duplicate.
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 entries in the specified IP address whitelist exceeds the upper limit. You can specify up to 1,000 entries for an IP address whitelist.
400 InvalidDBInstanceDescription.Format Specified DB instance description is not valid. The error message returned because the value of the DBInstanceDescription parameter is invalid. Specify a valid value for the parameter. The value of this parameter must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The value must start with a letter.
400 InvalidStorage.Format Specified Storage is not valid. The error message returned because the value of the Storage parameter is invalid. Specify a valid value for the parameter.
400 InvalidDBInstanceConnType.Format Specified DB instance conn type is not valid. The error message returned because the network type of the instance does not support this operation.
400 PreCheckInvalid CreateDdrInstance PreCheck Is Invalid The error message returned because the precheck for the CreateDdrInstance operation is invalid.
400 IncorrectDBInstanceType Current DB instance engine and type does not support operations. The error message returned because the operation is not supported for the database engine and instance type of the instance.
400 InvalidRestoreType.Format Specified restore type is not valid. The error message returned because the specified restoration type is invalid. Specify a valid restoration type.
400 NoBackupSetRegion BackupSetRegion is absence. The error message returned because the backup region does not exist.
400 NoBaksetName BaksetName is absence. The error message returned because the name of the backup set does not exist.
400 NoSourceInstanceName No SourceDBInstanceName. The error message returned because the name of the source instance is not found.
400 NoAvailableDisasterRestoreBakset No available disaster restore bakset. The error message returned because no available backup sets are found.
400 InvalidBackupType.Format Specified backup type is not valid. The error message returned because the backup type is invalid.
400 IncorrectEngineVersion Current engine version does not support operations. The error message returned because this operation is not supported for the database engine version that is run on the instance.
400 DisasterRestoreRegionNotMatched Disaster restore should be operated in the ddr region or source region. The error message returned because the disaster recovery must be performed in the region of the source or destination instance.
403 IncorrectBackupSetMethod Current backup set method does not support operations. The error message returned because the specified backup set cannot be used to restore individual databases and tables.
403 IncorrectBaksetVersion Current bakset version does not support operations. The error message returned because the operation is not supported for the version of the backup set.
403 CrossRegionUnsupportTDE Cross-region disaster restore not support TDE bakset. The error message returned because the TDE-based backup set cannot be used to restore an instance to another region.
404 InvalidRegion.NotFound Specified Region does not exist in the RDS The error message returned because the region ID is invalid.
404 InvalidClusterName.NotFound The specified cluster name is not available. The error message returned because the cluster name does not exist. Check the cluster name and try again.
404 InvalidDBInstanceClass.NotFound Specified DB instance class is not found. The error message returned because the new instance type cannot be found or is no longer available for purchase. Select an available instance type.
404 InvalidDBInstanceNetType.NotFound Specified DB instance net type is not found. The error message returned because the network type of the instance is invalid. Check the network type.
404 RestoreType.NotFound RestoreType is not found. The error message returned because the specified restoration method does not exist.
404 InvalidBackupSetID.NotFound Specified backup set ID does not exist. The error message returned because the specified backup set does not exist. You must check the existing backup sets.

For a list of error codes, see Service error codes.