PolarDB for MySQL Enterprise Edition lets you switch the Virtual Private Cloud (VPC) and vSwitch online while the cluster stays in the same zone. The cluster endpoint remains unchanged after the switch.
If your Elastic Compute Service (ECS) instance and the PolarDB cluster are in different VPCs, they cannot communicate over a private network. Move the cluster to the same VPC as your ECS instance to enable private network connectivity.
Prerequisites
Before you begin, make sure your cluster meets all of the following conditions:
Database Edition: Enterprise Edition (set at cluster creation)
Edition: Cluster Edition (set at cluster creation)
Billing method: Subscription or Pay-as-you-go
Limitations
You cannot switch the VPC and vSwitch of the primary endpoint or a cluster endpoint individually. Only custom endpoints support individual VPC and vSwitch changes.
The cluster's zone cannot be changed by this operation.
Before you switch: understand what changes and what doesn't
Switching the default VPC does not automatically move all existing custom endpoints. Use the Existing Endpoint Switching option to control this behavior:
| Setting | Effect |
|---|---|
| No (default) | Only the default VPC and default vSwitch are updated. Existing custom endpoints keep their current VPC and vSwitch settings. |
| Yes | The default VPC and default vSwitch are updated, and all existing custom endpoints move to the new VPC and vSwitch. |
The default VPC and default vSwitch are pre-selected when you create a custom endpoint. If you select a different VPC or vSwitch at endpoint creation, the cluster's default VPC and vSwitch are updated to match.
Impact of the switch
| Impact | Details |
|---|---|
| Transient connection interruption | A connection interruption of approximately 30 seconds occurs during the switch. Perform the switch during off-peak hours and configure your application to reconnect automatically. |
| DNS cache | After the switch, stale endpoint information may remain in the DNS cache until entries expire, causing connection failures. Restart the application or flush the DNS cache on the host to resolve this. |
| DMS and DTS connections | Connections to Data Management (DMS) and Data Transmission Service (DTS) are briefly interrupted. Both resume automatically once the cluster connects to the new VPC and vSwitch. |
Change the default VPC and vSwitch
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where the cluster resides, then click the cluster ID to go to the Basic Information page.
On the Basic Information page, click Switch next to Default VPC. In the Switch VPC dialog box, select the target VPC and vSwitch.
ImportantIf you select No for Existing Endpoint Switching, existing custom endpoints are not moved to the new VPC and vSwitch.

Change the VPC and vSwitch of a custom endpoint
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where the cluster resides, then click the cluster ID to go to the Basic Information page.
In the Database Connections section, select a custom endpoint. In the Modify Endpoint Settings dialog box, choose More > Edit.


In the Modify Private Endpoint dialog box, select the target VPC and vSwitch.

Specify the VPC and vSwitch when creating a custom endpoint
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where the cluster resides, then click the cluster ID to go to the Basic Information page.
In the Database Connections section, click Create Custom Cluster Endpoint. In the Create Custom Cluster Endpoint dialog box, select the target VPC and vSwitch.
ImportantThe cluster's default VPC and default vSwitch are pre-selected. If you select a different VPC or vSwitch, the cluster's default VPC and default vSwitch are updated to match after the endpoint is created.

