This topic describes how to switch the network type of an ApsaraDB for MongoDB instance from classic network to virtual private cloud (VPC) by using the console or by calling the relevant API operation. When you switch the network type, you can specify a period during which you want to retain the classic network endpoint of the instance. After the retention period expires, the classic network endpoint is automatically deleted.
Prerequisites
Before you can switch the network type, make sure that the following conditions are met:- The network type is classic network.
- The instance must be a MongoDB replica set instance or a sharded cluster instance.
- VPCs and vSwitches are available in the zone to which the ApsaraDB for MongoDB instance belongs. For more information, see Create a VPC with an IPv4 CIDR block.
Switch the network type by using the console
- Log on to the ApsaraDB for MongoDB console.
- Find the ApsaraDB for MongoDB instance that you want to manage and click its ID.
- In the left-side navigation pane, click Database Connection, and then click Switch to VPC.
- In the Create Alert panel, perform the following steps:
- On the Database Connection page, you can view the classic network and VPC endpoints.