All Products
Search
Document Center

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

Last Updated:Mar 01, 2026

ApsaraDB for MongoDB lets you change the endpoint prefix and port number of instance nodes, so that applications can connect to a new instance without configuration changes after migration.

Supported changes by architecture

ArchitectureEndpoint changesPort changes
StandalonePrimary node only (internal and public)Not supported
Replica set (local SSDs or ESSDs)Primary, secondary, and read-only nodesMongoDB 4.2 or later with ESSDs
Sharded clusterMongos nodes onlyMongoDB 4.2 or later with ESSDs
Important

This procedure does not apply to the connection string URI of a replica set instance. A connection string URI includes the replicaSet parameter, which cannot be changed. If your application uses the connection string URI, you must update the URI in your application manually after changing the endpoint.

Connection types

Each ApsaraDB for MongoDB instance has two connection types:

  • Internal endpoint (VPC): For resources within the same Virtual Private Cloud (VPC). Provides lower latency and incurs no data transfer fees.

  • Public endpoint: For access over the internet. Available only after you apply for a public endpoint. For more information, see Apply for a public endpoint.

Prerequisites

Before you begin, make sure that you have:

  • An ApsaraDB for MongoDB instance in the Running state

  • A public endpoint applied for the instance, if you want to change the public endpoint

Change the endpoint or port

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region where your instance is deployed. Find the target instance and click its ID.

  2. In the left-side navigation pane, click Database Connections.

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

    Note

    The Update Connection String option appears in the Public Connections section only after a public endpoint is applied for the instance.

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

    ParameterDescription
    NodeThe node whose endpoint to modify. For a sharded cluster instance, only mongos nodes are available.
    Current Connection StringThe current endpoint of the selected node.
    New Connection StringThe prefix of the new endpoint. Must start with a lowercase letter, end with a lowercase letter or digit, contain only lowercase letters, digits, and hyphens (-), and be 8 to 64 characters in length.
    Port NumberThe port for the new endpoint. Valid values: 1000 to 65535.
  5. Click OK.

Verify the change

After the change takes effect, go to the Database Connections page. The updated endpoint and port are displayed in the Internal Connections - VPC or Public Connections section.

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.