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

The instance must run one of the following database engines:

  • MySQL with local SSDs, standard SSDs, or enhanced SSDs (ESSDs)
  • SQL Server with standard SSDs or ESSDs
  • MariaDB TX with standard SSDs or ESSDs
  • PostgreSQL with standard SSDs or ESSDs

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.

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 SwitchDBInstanceVpc

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

DBInstanceId String Yes rm-uf6wjk5*******

The ID of the instance.

Note
  • The instance must run one of the following database engines:
    • MySQL with local SSDs, standard SSDs, or ESSDs
    • SQL Server with standard SSDs or ESSDs
    • MariaDB TX with standard SSDs or ESSDs
    • PostgreSQL with standard SSDs or ESSDs
  • The instance must be in the Running state.
  • The instance must reside in a VPC.
  • The instance cannot be a temporary instance or use an instance type in the shared instance family.
VPCId String No vpc-uf6f7l4fg90**********

The ID of the VPC.

Note The VPC must belong to the same region as the instance.
VSwitchId String No vsw-uf6adz52c2p**********

The ID of the vSwitch.

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

The private IP address of the instance. The private IP address must be within the 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.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=SwitchDBInstanceVpc
&DBInstanceId=rm-uf6wjk5xxxxxxx	 
&VPCId=vpc-uf6f7l4fg90xxxxxxxxxx
&VSwitchId=vsw-uf6adz52c2pxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

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

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

JSON format

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

{
  "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.
400 InvalidInstanceKind.NotSupport The instance kind does not support this operation. The error message returned because the operation is not supported by the configuration of the instance.
400 InvalidPrivateIpAddress.Mismatch Specified private IP address is not in the CIDR block of virtual switch. The error message returned because the specified PrivateIpAddress parameter is invalid.

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