You can call the SwitchDBInstanceVpc operation to change the virtual private cloud (VPC) or vSwitch of an ApsaraDB RDS instance.

This operation is supported only for instances that run MySQL with local, standard, or enhanced solid-state drives (SSDs), MariaDB with standard or enhanced SSDs, or PostgreSQL with standard or enhanced SSDs.

For more information about the impact of VPC and vSwitch changes, see Switch an ApsaraDB RDS for MySQL instance to a new VPC and a new vSwitch.


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 SwitchDBInstanceVpc

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

  • The instance must run MySQL with local, standard, or enhanced SSDs, MariaDB with standard or enhanced SSDs, or PostgreSQL with standard or enhanced SSDs.
  • The instance must be in the Running state.
  • The instance must reside in a VPC.
  • The instance cannot be a temporary instance or a shared instance.
VPCId String No vpc-uf6f7l4fg90xxxxxxxxxx

The ID of the VPC to which the instance belongs.

  • The VPC must belong to the same region as the instance.
  • You can change the VPC of the instance only when the instance runs MySQL with local SSDs.
VSwitchId String No vsw-uf6adz52c2pxxxxxxxxxx

The ID of the vSwitch associated with the specified VPC.

Note The vSwitch must belong to the same zone as the instance.
PrivateIpAddress String No 10.23.xx.xx

The private IP address of the instance. The private IP address must be within the Classless Inter-Domain Routing (CIDR) block of the vSwitch that is specified by the VSwitchId parameter.

Note You can call the DescribeVSwitches operation to query the CIDR block of a specified vSwitch.

Response parameters

Parameter Type Example Description
RequestId String 777C4593-8053-427B-99E2-10xxxxxxxxxx

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format

<RequestId>777C4593-8053-427B-99E2-10xxxxxxxxxx	 </RequestId>

JSON format

    "RequestId": "777C4593-8053-427B-99E2-10xxxxxxxxxx"

Error codes

HTTP status code Error code Error message Description
400 MigrateAlreadyExistsFault Duplicate migration is forbidden. The error message returned because a duplicate migration task is found.

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