You can call the MigrateToOtherZone operation to migrate an ApsaraDB RDS instance across zones.

The prerequisites for this operation vary based on the database engine of the instance. For more information, see the following topics:

Note You can call this operation to migrate an instance between zones only within the same region. For example, you cannot migrate the instance from a zone in the China (Hangzhou) region to a zone in the China (Qingdao) region.

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 MigrateToOtherZone

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances.

VPCId String No vpc-xxxxxxx

The ID of the virtual private cloud (VPC). Do not change the VPC of the instance.

Note This parameter must be specified when the instance resides in a VPC.
ZoneId String Yes cn-hangzhou-b

The ID of the destination zone. You can call the DescribeRegions operation to query the zone ID.

EffectiveTime String No Immediate

The time at which you want the change to take effect. Valid values:

  • Immediate: The change immediately takes effect.
  • MaintainTime: The change takes effect during the maintenance window that you specify. For more information, see ModifyDBInstanceMaintainTime.
  • ScheduleTime: The change takes effect at the time that you specify.

Default value: Immediate.

Note If you set this parameter to ScheduleTime , you must specify the SwitchTime parameter.
VSwitchId String No vsw-uf6adz52c2pxxxxxxx

The ID of the vSwitch.

Note This parameter must be specified when the instance resides in a VPC.
Category String No HighAvailability

The RDS edition of the instance. Valid values:

  • Basic: RDS Basic Edition.
  • HighAvailability: RDS High-availability Edition.
  • AlwaysOn: RDS Cluster Edition.
  • Finance: RDS Enterprise Edition
ZoneIdSlave1 String No cn-hangzhou-c

The secondary zone numbered 1 of the instance.

Note You must specify this parameter when the instance does not run RDS Basic Edition.
ZoneIdSlave2 String No cn-hangzhou-d

The secondary zone numbered 2 of the instance.

Note You can specify this parameter only when the instance runs RDS Enterprise Edition.
SwitchTime String No 2021-12-14T15:15:15Z

The time at which you want the change to take effect. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format . The time must be in UTC.

Note This parameter is used with the EffectiveTime parameter and takes effect only when the EffectiveTime parameter is set to ScheduleTime.

Response parameters

Parameter Type Example Description
RequestId String 65BDA532-28AF-4122-AA39-B382721EEE64

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=MigrateToOtherZone
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&ZoneId=cn-hangzhou-b
&<Common request parameters>

Sample success responses

XML format

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

<?xml version="1.0" encoding="UTF-8" ?>
<MigrateToOtherZoneResponse>
	<RequestId> 65BDA532-28AF-4122-AA39-B382721EEE64</RequestId></MigrateToOtherZoneResponse>

JSON format

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

{
  "RequestId" : " 65BDA532-28AF-4122-AA39-B382721EEE64"
}

Error codes

HTTP status code Error code Error message Description
400 IncorrectDBInstanceLockMode.ValueNotSupported The Current DB instance lock mode does not support this operation. The error message returned because this operation is not supported when the instance is in the current lock mode.
400 InvalidZoneId.NotNull The parameter ZoneId must not be null or auto The error message returned because the value of the ZoneId parameter is null or auto.
400 InvalidZoneId.NotEqual The parameter ZoneId is the same as the previous one The error message returned because the destination zone is the same as the original zone.
400 IncorrectDBInstanceType Current DB instance type does not support this operation. The error message returned because this operation is not supported when the instance is in the current state.
403 OperationDenied.OutofUsage The resource is out of usage. The error message returned because the specified zone does not provide sufficient resources. Select another zone and try again.

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