ApsaraDB for MongoDB must be accessed using MongoDB Shell 3.0 or later versions; otherwise, authentication fails.
Log on to the MongoDB console.
Locate the target instance, click the instance ID or Manage to go to the Basic Information page, as shown in the following figure. Obtain the domain name and port number for MongoDB connection.
The connection address is displayed in the red box 1.
The port number is displayed in the red box 2. The connection address and port number are separated by a colon.
In ECS, use the mongo command to establish a connection. A command example is as follows:
mongo --host dds-xxxx.mongodb.rds.aliyuncs.com:3717 -u root -p 123456 --authenticationDatabase admin