All Products
Search
Document Center

ApsaraDB for MongoDB:Modify the endpoint and port of an instance

Last Updated:Jun 18, 2025

ApsaraDB for MongoDB allows you to modify the internal endpoint, public endpoint, and port of an instance.

Limits

Instance architecture

Endpoint

Port

Scenario for switching to a new instance

Standalone instance

You can modify only the public and internal endpoints of the primary node in a standalone instance.

You cannot modify the port of a standalone instance.

You can modify the endpoint and port of a new instance to match those of the original instance. This way, you do not need to modify the endpoint and port in your application.

Replica set instance

You can modify the endpoints of the primary, secondary, and read-only nodes for an instance that uses local SSDs and ESSDs.

You can modify the port of an instance that runs MongoDB 4.2 or later and uses ESSDs.

The connection string of a high availability address for a replica set instance contains replicaSet information that cannot be modified. Therefore, when you switch to a new instance, you need to modify the endpoint and port in your application.

Sharded cluster instance

  • For a MongoDB-compatible sharded cluster instance, you can modify only the endpoints of the mongos nodes.

  • For a DynamoDB-compatible sharded cluster instance, you can modify the endpoint of the ConfigServer node.

You can modify the port of an instance that runs MongoDB 4.2 or later and uses ESSDs.

You can modify the endpoint and port of a new instance to match those of the original instance. This way, you do not need to modify the endpoint and port in your application.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select a resource group and region. Then, click the ID of the target instance.

  2. In the left-side navigation pane of the instance details page, click Database Connections.

  3. In the Internal Connections - VPC or Public Connections section, click Update Connection String.

    Note

    The Public Connections section displays the Update Connection String button only after you apply for a public endpoint for the MongoDB instance. For more information, see Apply for a public endpoint.

  4. In the Update Connection String panel, configure the parameters.

    Parameter

    Description

    Node

    The node whose endpoint you want to modify. Select the node from the drop-down list.

    Note

    You can modify only the endpoint of a mongos node for a sharded cluster instance.

    Current Connection String

    The current endpoint of the node.

    New Connection String

    The prefix of the new endpoint of the node, which must meet the following requirements:

    • The prefix must start with a lowercase letter.

    • The prefix must end with a lowercase letter or a digit.

    • The prefix must be 8 to 64 characters in length and can contain lowercase letters, digits, and hyphens (-).

    Port Number

    The port corresponding to the new endpoint. Valid values: 1000 to 65535.

  5. Click OK.

What to do next

After you modify the endpoint of the node, connect your client to the instance by using the new endpoint and port.