You can call the MigrateToOtherZone operation to migrate an ApsaraDB RDS instance across multiple zones that belong to the same region.

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

Note This operation allows you to migrate an instance across multiple zones that belong to the same region. This operation does not allow you to migrate an instance across multiple zones that belong to different regions. For example, you cannot migrate an 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 instance ID.

VPCId String No vpc-xxxxxxx

The ID of the virtual private cloud (VPC) to which the new instance belongs. Do not change the VPC of the instance.

Note
  • If the instance resides in a VPC, you must specify this parameter.
  • If the instance runs SQL Server, you can change the VPC of the instance.
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:

  • Immediately: The change immediately takes effect. This is the default value.
  • MaintainTime: The change takes effect during the planned maintenance window. For more information, see ModifyDBInstanceMaintainTime.
  • ScheduleTime: The change takes effect at the point in time that you specify.
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
  • If the instance resides in a VPC, you must specify this parameter. You can call the DescribeVSwitches operation to query the vSwitch ID.
  • If the instance runs PostgreSQL or SQL Server and a secondary zone is specified for the instance, you can specify multiple vSwitch IDs, each of which corresponds to a zone. Separate the vSwitch IDs with commas (,).
Category String No HighAvailability

The RDS edition of the read-only 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 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 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 point in 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. You must specify this parameter only when the EffectiveTime parameter is set to ScheduleTime.
IsModifySpec String No true

Specifies whether to change the specifications of the instance during the migration. Valid values:

  • true: You do not want to change the specifications of the instance during the migration. If you set this parameter to true, you must specify at least one of the DBInstanceClass and DBInstanceStorage parameters.
  • false: You want to change the specifications of the instance during the migration. This is the default value.
Note This parameter is valid only for instances that run MySQL.
DBInstanceClass String No mysql.x4.xlarge.2

The new instance type of the instance. You can change the instance type of the instance. You cannot change the storage type of the instance.

If you set the IsModifySpec parameter to true, you must specify at least one of the DBInstanceClass and DBInstanceStorage parameters.

For more information about instance types, see Primary Asparagus RDS for MySQL instance types.

DBInstanceStorage Long No 500

The new storage capacity of the instance. If you set the IsModifySpec parameter to true, you must specify at least one of the DBInstanceStorage and DBInstanceClass parameters.

Unit: GB.

The available storage capacity range varies based on the specifications of the instance. For more information, see Primary ApsaraDB RDS for MySQL instance types.

Response parameters

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

The ID of the request.

DBInstanceId String rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

OrderId Long 213341575990728

The ID of the order. This parameter is returned only when the instance runs MySQL.

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

<MigrateToOtherZoneResponse>
    <RequestId>65BDA532-28AF-4122-AA39-B382721EEE64</RequestId>
    <DBInstanceId>rm-uf6wjk5xxxxxxxxxx</DBInstanceId>
</MigrateToOtherZoneResponse>

JSON format

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

{
  "RequestId" : "65BDA532-28AF-4122-AA39-B382721EEE64",
  "DBInstanceId" : "rm-uf6wjk5xxxxxxxxxx"
}

Error codes

HTTP status code Error code Error message Description
400 EngineNotSupported Engine specified cannot be supported the operation. The error message returned because this operation is not supported for the database engine that is run on the instance. You must update the minor engine version.
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 source 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.
400 IncorrectDBInstanceState Current DB instance state 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. You must select another zone.

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