This topic describes how to enable or disable password-free access over a VPC for an ApsaraDB for MongoDB instance. This makes database connections easy and secure. After password-free access is enabled, the ECS instance that shares the same VPC with the ApsaraDB for MongoDB instance can connect to a database of this ApsaraDB for MongoDB instance without a password. You can still use a database username and its password to connect to this database.

Prerequisites

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the region of the instance.
  3. In the left-side navigation pane, click Replica Set Instances or Sharding Instances.
  4. Find the instance and click its ID.
  5. In the left-side navigation pane, click Database Connection.
  6. In the upper-right corner of the Intranet Connection - VPC section, click Enable password-free access or Disable password-free access.
    • Enable password-free access. Enable password-free access

      After password-free access is enabled, the ECS instance that shares the same VPC with the ApsaraDB for MongoDB instance can connect to a database of this ApsaraDB for MongoDB instance without a password. You can still use a database username and its password to connect to this database.

      Note If you want to connect to a database of an ApsaraDB for MongoDB instance without entering a password, add the IP address of your client to a whitelist of this instance. For more information, see Configure a whitelist.
      The following command provides an example of a password-free connection by using the mongo shell:
      mongo --host dds-bpxxxxxxxx.mongodb.rds.aliyuncs.com:3717
    • Disable password-free access.
      Note After password-free access is disabled, the applications that have established connections with a database of this ApsaraDB for MongoDB instance are disconnected. You must change the database connection mode for your application before you disable password-free access.
      Disable password-free access
  7. In the message that appears, click OK.

Related operations

Operation Description
ModifyInstanceVpcAuthMode Enables or disables password-free access over a VPC for an ApsaraDB for MongoDB instance.