Alibaba Cloud provides two types of internal networks: classic network and Virtual Private Cloud (VPC). An Elastic Compute Service (ECS) instance and an ApsaraDB for MongoDB instance can communicate over the internal network across zones, as long as both instances share the same network type — and, for VPC, the same VPC.
Prerequisites
Before you begin, ensure that you have:
An ECS instance and an ApsaraDB for MongoDB instance in the same region
Confirmed the network type of your ECS instance (classic network or VPC)
Connect an ECS instance to a new ApsaraDB for MongoDB instance
When purchasing a new ApsaraDB for MongoDB instance in a different zone from your ECS instance, follow the requirements for your network type:
If the ECS instance uses VPC:
Deploy the new MongoDB instance in the same VPC as the ECS instance. Create a vSwitch in the zone where the MongoDB instance will be deployed. The two instances can then communicate over the internal network.
If the ECS instance uses classic network:
Deploy the new MongoDB instance in the classic network of the same region as the ECS instance. The two instances can then communicate over the internal network.
Connect an ECS instance to an existing ApsaraDB for MongoDB instance
If the two instances have the same network type:
They can communicate over the internal network directly. If both use VPC, they must be in the same VPC.
If the two instances have different network types:
Switch the network type of the ApsaraDB for MongoDB instance to match the ECS instance's network type. For details, see Switch the network type of an ApsaraDB for MongoDB instance from classic network to VPC.
You cannot switch the network type of an ApsaraDB for MongoDB standalone instance.