ApsaraDB supports two types of network: classic and Virtual Private Cloud (VPC). On the Alibaba Cloud platform, a classic network and VPC have the following differences:
Classic network: Cloud services on the classic network are not isolated, and unauthorized access can only be blocked by the security group or whitelist policy of the cloud services.
VPC: This helps you build an isolated network environment on Alibaba Cloud. You can customize the route table, IP address range, and gateway on the VPC. In addition, you can combine your on-premises IDC with cloud resources in the Alibaba Cloud VPC through a leased line or VPN to migrate applications to the cloud.
By default, MongoDB uses the classic network type. If you want to use VPC, guarantee that the MongoDB and VPC instances are in the same region. You may create a VPC instance in either of the following scenarios:
If no MongoDB instance exists, create a VPC instance and then create a MongoDB instance in VPC. For more information, see Create a MongoDB instance.
If a MongoDB instance already exists, create a VPC instance in the region where the MongoDB instance is located and add the MongoDB instance to the VPC instance to change the network type of the MongoDB instance. This chapter describes how to change the network type for MongoDB instances.
Create a VPC instance in the region where the MongoDB instance is located. For more information, see Create VPC.
Log on to the MongoDB console and find the target instance.
In the work area, choose More > Changing the Network Type.
On the Switch to VPC page, select the VPC and VSwitch and click OK, as shown in the following figure.