You can install the mongo shell on an ECS instance and use the mongo shell to connect to ApsaraDB for MongoDB.


To ensure successful authentication, use mongo shell 3.0 or a later version to connect to ApsaraDB for MongoDB.


  1. Log on to the ApsaraDB for MongoDB console.
  2. Click the target instance ID or choose > Manage in the Operation column to go to the Basic Information page of the target instance.
  3. In the left-side navigation pane, click Database Connection.

    • Red boxes highlight the connection information.
    • In each connection address, the default port number is 3717 and the domain name is separated from the port number with a colon (:).
  4. In the ECS instance, run a mongo command to connect to ApsaraDB for MongoDB. The following command is an example:
    mongo --host -u root -p Ft123456 --authenticationDatabase admin


Mongo shell FAQs