This topic describes how to apply for a public endpoint for a replica set instance when you want to connect to this instance over the Internet.

Background information

The following table describes the connections supported by ApsaraDB for MongoDB.

Connection type Description
Intranet Connection - VPC
  • A VPC is an isolated network with higher security and performance than a classic network.
  • By default, ApsaraDB for MongoDB provides endpoints on a VPC.
Intranet Connection - Classic Network Cloud services on a classic network are not isolated. Unauthorized access can only be blocked by using security groups or whitelists. You can switch the network type to VPC. For more information, see Switch the network type of an ApsaraDB for MongoDB instance.
Public IP Connection
  • Connecting to a replica set instance over the Internet is risky. Therefore, ApsaraDB for MongoDB does not provide public endpoints.
  • If you want to connect to a replica set instance from a device outside Alibaba Cloud (for example, a local client), you must apply for a public endpoint.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Replica Set Instances.
  4. Find the target instance and click its ID.
  5. In the left-side navigation pane, click Database Connection.
  6. In the Public IP Connection section, click Apply for Public Connection String.
    Apply for a public endpoint
  7. In the Apply for Public Connection String message that appears, click OK.
    Note If you want to connect to a replica set instance by using a public endpoint, you must add the public IP address of your client to a whitelist of this instance. For more information, see Configure a whitelist for a replica set instance.

After the application is complete, the replica set instance generates new endpoints for both the primary and secondary nodes and the corresponding connection string URI. For more information, see Overview of replica set instance connections.