Note: ApsaraDB for MongoDB must be accessed using MongoDB Shell 3.0 or later versions; otherwise, authentication fails.
Log on to the MongoDB console.
Click an instance ID or View to go to the Basic Information page, as shown in the following figure. Then, obtain the domain name and port number for MongoDB connection.
Enclosed in red frames are the connection addresses and port numbers of two nodes, which are separated by colons.
On ECS, use the mongo command to establish a connection. A command example is shown as follows.
mongo --host dds-xxxx.mongodb.rds.aliyuncs.com:3717 -u root -p 123456 --authenticationDatabase admin