All Products
Search
Document Center

ApsaraDB for MongoDB:Connect an ECS instance to an ApsaraDB for MongoDB instance in a different region over the internal network

Last Updated:Jul 11, 2024

This topic describes how to connect an Elastic Compute Service (ECS) instance to an ApsaraDB for MongoDB instance in a different region over the internal network.

Prerequisites

The ECS instance and ApsaraDB for MongoDB instance use the Virtual Private Cloud (VPC) network type.

If the two instances use different network types or are in the classic network, we recommend that you switch the network type of the ECS instance or ApsaraDB for MongoDB instance from classic network to VPC before you perform the operations described in this topic. You can use one of the following methods to switch the network type of the ECS instance or ApsaraDB for MongoDB instance from classic network to VPC:

Migrate the ApsaraDB for MongoDB instance to the region where the ECS instance is located

This method uses the data migration feature of Data Transmission Service (DTS) to migrate the ApsaraDB for MongoDB instance to the region where the ECS instance is located. For example, you can migrate an ApsaraDB for MongoDB instance from the China (Qingdao) region to the China (Hangzhou) region. For more information about DTS, see What is DTS?

  1. Create an ApsaraDB for MongoDB instance in the region where the ECS instance is located. For more information, see Create a replica set instance. If you have already created an ApsaraDB for MongoDB instance, skip this step.

    Note

    When you create the ApsaraDB for MongoDB instance, select the same VPC as that of the ECS instance.

  2. Migrate MongoDB databases in the source region to the destination ApsaraDB for MongoDB instance. For more information, see Migrate data between ApsaraDB for MongoDB instances across regions.

  3. Add the private IP address of the ECS instance to a whitelist of the ApsaraDB for MongoDB instance. For more information, see Modify an IP address whitelist of an ApsaraDB for MongoDB instance.

    Note

    For more information about how to obtain the IP address of an ECS instance, see View instance information.

Migrate the ECS instance to the region where the ApsaraDB for MongoDB instance is located

You can use the custom image feature or the migration tool to migrate the ECS instance data to the region where the ApsaraDB for MongoDB instance is located. For example, you can migrate the ECS instance from the China (Qingdao) region to the China (Hangzhou) region.