This topic describes how to enable or disable password-free access over a virtual private cloud (VPC) for an ApsaraDB for MongoDB instance. This allows easy and secure connection to databases. After password-free access over a VPC is enabled for an ApsaraDB for MongoDB instance, all Elastic Compute Service (ECS) instances that reside within the same VPC can access the ApsaraDB for MongoDB instance without using passwords. In the meantime, you can still use a username and password to access the ApsaraDB for MongoDB instance.

Precautions

  • Password-free access over a VPC is available only for sharded cluster instances that run MongoDB 4.0 or 4.2 and replica set instances that run 4.0, 4.2, 4.4, or 5.0.
    Note Password-free access is unavailable for replica set instances that have Active-standby Nodes set to Standalone.
  • After password-free access over a VPC is enabled for an ApsaraDB for MongoDB instance, ECS instances that reside in the same VPC have the same permissions as the root account of the ApsaraDB for MongoDB instance.
  • To access an ApsaraDB for MongoDB instance without using passwords, you must first add the IP addresses of clients that you use to a whitelist of the instance. For more information, see Configure a whitelist or an ECS security group for an ApsaraDB for MongoDB instance.
  • After password-free access over a VPC is disabled for an ApsaraDB for MongoDB instance, applications cannot access the instance without using passwords. Modify the application access method before you disable password-free access over a VPC.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
  3. In the upper-left corner of the page, select the resource group and region to which the instance belongs.
  4. Click the ID of an instance, or click More icon in the Actions column corresponding to the instance and select Manage.
  5. In the left-side navigation pane of the instance details page, click Database Connections.
  6. In the Internal Connections section, click Enable Password-free Access or Disable Password-free Access.
  7. In the Enable Password-free Access or Disable Password-free Access message that appears, click OK.
    Note To access an ApsaraDB for MongoDB instance without using passwords, you must first add the IP addresses of clients that you use to a whitelist of the instance. For more information, see Configure a whitelist or an ECS security group for an ApsaraDB for MongoDB instance.

Related API operations

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