This topic describes how to switch the network type of an ApsaraDB for MongoDB instance between Classic Network and VPC in the ApsaraDB for MongoDB console.

Prerequisites

The instance is a replica set or sharded cluster instance.

Note For a standalone instance, its network type is always VPC and cannot be changed.

Precautions

Switching the network type of an instance causes a brief disconnection of the instance. We recommend that you perform this operation during off-peak hours or make sure that your application is configured to reconnect to the instance after it is disconnected. This protects your business against the brief disconnection.

Note You can choose to retain the internal endpoints on the classic network. This way, you can switch the network type without a brief disconnection. For more information, see Configure a hybrid access solution to switch the network type of an ApsaraDB for MongoDB instance from Classic Network to VPC.

Internal connection addresses

  • Intranet Connection - Classic Network: Cloud services on a classic network are not isolated. Unauthorized access can only be blocked by the security groups or whitelists of the cloud services.
  • Intranet Connection - VPC: A VPC is an isolated virtual network with better security and performance than a classic network. By default, an ApsaraDB for MongoDB instance provides internal endpoints on a VPC.

Switch from Classic Network to VPC

  1. Create a VPC in the same region as the target ApsaraDB for MongoDB instance. For more information, see Create a VPC.
  2. Log on to the ApsaraDB for MongoDB console.
  3. In the upper-left corner of the page, select the region of the instance.
  4. In the left-side navigation pane, click Replica Set Instances or Sharding Instances.
  5. Find the instance and click its ID.
  6. In the left-side navigation pane, click Database Connection.
  7. In the Intranet Connection - Classic Network section, click Switch to VPC.Switch to VPC
  8. In the VPC dialog box that appears, specify VPC and VSwitch.Configure the VPC
    Note
    • You can turn on Retain the connection address of the classic network to generate new internal endpoints on the VPC and keep the existing internal endpoints on the classic network within a specified period. When an internal endpoint on a classic network expires, it is automatically released.
    • If you do not turn on Retain the connection address of the classic network, there may be a brief disconnection while you switch the network type. In this case, Alibaba Cloud services (such as ECS) on the classic network cannot connect to this instance.
  9. Click OK.

Switch from VPC to Classic Network

After you switch the network type of the instance to Classic Network, the internal endpoints on the VPC are released and ECS instances in the VPC can no longer connect to this instance with these endpoints. ApsaraDB for MongoDB generates new internal endpoints on the classic network and retains the same public endpoints. You must modify the connection information for your application.
Note After you switch the network type of the instance to Classic Network, ECS instances in the VPC can no longer connect to this instance. While you switch the network type of the instance, there may be a brief disconnection. We recommend that you perform this operation during off-peak hours or make sure that your application is configured to reconnect to the instance after it is disconnected. This protects your business against the brief disconnection.
  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the region of the instance.
  3. In the left-side navigation pane, click Replica Set Instances or Sharding Instances.
  4. Find the instance and click its ID.
  5. In the left-side navigation pane, click Database Connection.
  6. In the Intranet Connection - VPC section, click Switch to Classic Network.Switch to Classic Network
  7. In the message that appears, click OK.