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

Background information

The following table describes the endpoint types supported by ApsaraDB for MongoDB.

Endpoint type Description
VPC endpoint
  • A virtual private cloud (VPC) is an isolated network that provides higher security and performance than the classic network.
  • By default, ApsaraDB for MongoDB provides endpoints on a VPC.
Classic network endpoint Cloud services on the classic network are not isolated. Unauthorized access can be blocked only 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.
Note Standalone instances cannot be connected over the classic network.
Public endpoint
  • Your ApsaraDB for MongoDB instance is at risk when you connect to it over the Internet. For this reason, ApsaraDB for MongoDB does not provide public endpoints by default.
  • If you want to connect to an ApsaraDB for MongoDB instance from a device outside Alibaba Cloud (such as an on-premise device), you must apply for a public endpoint.

Precautions

When you apply for a public endpoint for an instance, the instance may need to restart. We recommend that you perform this operation during off-peak hours.

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 or Sharded Cluster Instances.
  4. Find the target instance and click its ID.
  5. In the left-side navigation pane, click Database Connections.
  6. In the Public Connections section, click Apply for Public Connection String.
    Apply for a public endpoint
  7. Perform the corresponding operations based on the instance category:
    • Standalone or replica set instances

      In the Apply for Public Connection String panel, click OK.

    • Sharded cluster instances
      In the Apply for Public Connection String panel, set Node Type and Node ID, and click OK. Select a node
      Parameter Value Description
      Node Type Shard The shard node. To apply for a public endpoint for a shard node, you must first apply for an endpoint for the shard node. For more information, see Apply for an endpoint for a shard or Configserver node.

      If you want to read the oplog data of a shard node over the Internet when you perform specific operations such as data synchronization between clusters, you must apply for a public endpoint for the shard node.

      CS The Configserver node. To apply for a public endpoint for a Configserver node, you must first apply for an endpoint for the Configserver node. For more information, see Apply for an endpoint for a shard or Configserver node.

      If you want to read the configuration information of a Configserver node over the Internet when you perform specific operations such as data synchronization between clusters, you must apply for a public endpoint for the Configserver node.

      Mongos The mongos node. This is the default option because your application is connected to a mongos node in most cases.
      Node ID Node ID of the current instance The ID of the node for which you want to apply for a public endpoint.
      Note
  8. Optional:To apply for public endpoints for multiple nodes in a sharded cluster instance, repeat the preceding steps.
    Note To apply for a public endpoint for another node in the instance, you must wait until the state of the instance becomes Running.

Result

After you have applied for public endpoints, you can view the public endpoints in the Public Connections section. For more information about endpoints, see Connect to a replica set instance.

References