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 an ApsaraDB for MongoDB replica set instance.
  • VPCs and vSwitches are available in the zone to which the ApsaraDB for MongoDB instance belongs. For more information, see Create an IPv4 VPC.

Switch the network type by using the console

  1. Log on to the ApsaraDB for MongoDB console.
  2. Find the ApsaraDB for MongoDB instance that you want to manage and click its ID.
  3. In the left-side navigation pane, click Database Connection, and then click Switch to VPC.
  4. In the Create Alert panel, perform the following steps:
    1. Select the VPC and vSwitch that you want to use.
    2. You can choose to retain the classic network endpoint and specify a retention period.
      Note If you choose to retain the classic network endpoint, ECS instances in a classic network can still access the database. When the retention period expires, the classic endpoint is automatically deleted and you can no longer access the database through the classic network endpoint.
    3. Click OK.
  5. On the Database Connection page, you can view the classic network and VPC endpoints.
    RDS

Switch the network type by calling the relevant API operation

For more information about how to switch the network type by calling the relevant API operation, see ModifyDBInstanceNetworkType.