This topic describes how to change the virtual private cloud (VPC) and vSwitch of an ApsaraDB RDS for MySQL instance.
For more information about how to change the VPC and vSwitch of an RDS instance, see Switch an ApsaraDB RDS for PostgreSQL instance to a different vSwitch.
Prerequisites
The RDS instance uses the subscription or pay-as-you-go billing method.
The VPC or vSwitch of a serverless RDS instance cannot be changed.
Limits
If your RDS instance uses local disks, you can directly change the VPC and vSwitch of the RDS instance.
If your RDS instance uses cloud disks and you want to change the VPC of the RDS instance, the minor engine version of your RDS instance must be 20201031 or later. For more information, see Update the minor engine version.
If no vSwitches are available in the VPC in the current zone, go to the VPC console to create a vSwitch.
Impacts
When you change the VPC and vSwitch of your RDS instance, an instance switchover occurs. Make sure that your application is configured to automatically reconnect to the RDS instance. For more information about the impacts of an instance switchover, see Impacts of an instance switchover.
When you change the VPC and vSwitch of your RDS instance, the virtual IP addresses (VIPs) of your RDS instance also change. We recommend that you connect your application to your RDS instance by using an endpoint instead of an IP address. For more information, see Configure endpoints.
VIP changes affect the availability of PolarDB-X for a short period of time. Refresh and view the connection information in the PolarDB-X console in a timely manner.
VIP changes interrupt the connection between your RDS instance and Data Management (DMS) and the connection between your RDS instance and Data Transmission Service (DTS) for a short period of time. After the VPC and vSwitch of your RDS instance are changed, the connections are automatically resumed.
If Domain Name System (DNS) caching is enabled on your database client, you can read data but cannot write data. We recommend that you clear the cache on the client at the earliest opportunity.
Procedure
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, click Database Connection.
In the Database Connection section of the page that appears, click Switch vSwitch.
In the dialog box that appears, select a required vSwitch and VPC and click OK.
NoteIf you want to create a VPC or a vSwitch, click go to the VPC console.
In the message that appears, click OK.
NoteIf you use RDS Cluster Edition, you can also click Edit in the Instance Topology Management section of the Basic Information page. In the dialog box that appears, click Change VPC/vSwitch to change the VPC and vSwitch.
FAQ
How do I change the VPC of an RDS instance if I cannot directly change the VPC and vSwitch of the instance?
You cannot directly change the VPC of an RDS instance whose minor engine version is earlier than 20201031. If you want to change the VPC of the RDS instance, use the following methods:
Update the minor engine version of the RDS instance. Then, perform the operations that are described in this topic. For more information, see Update the minor engine version.
If you do not want to update the minor engine version of the RDS instance, purchase a new RDS instance that resides in the required VPC. Then, migrate the data of the original RDS instance to the new RDS instance. For more information, see Create an ApsaraDB RDS for MySQL instance and Migrate data between ApsaraDB RDS for MySQL instances.