The IP whitelist function provides access control for your MongoDB instance by limiting IP addresses that can connect to your database, enhancing security. Properly configuring the IP whitelist serves as the first layer of security for your MongoDB database. By default, only 127.0.0.1 (localhost) is added to the IP whitelist, which means external clients will be denied access until you add their specific IP addresses.
Prerequisites
You have successfully created an instance.
The instance status is Running.
Procedure
The following steps describe how to modify the default whitelist group of an instance. For more information about how to create another whitelist group or configure a security group, see Configure an IP addresswhitelist or an ECS security group for an instance.
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the resource group and region to which the desired instance belongs. Then, find the instance and click the instance ID.
In the left-side navigation pane of the instance details page, choose .
In the Whitelist Settings page, choose one of the following methods to modify your whitelist group:
Manual configuration
Click Modify in the Actions column of the target group.
In the IP Whitelist field of the Manually Modify panel, enter IP addresses or IP address ranges:
Support for single IP address format, e.g., 10.23.12.24.
Support for 0.0.0.0/0.
WarningSetting to 0.0.0.0/0 means no restrictions are imposed on the sources of IP addresses accessing the database. This leaves the cloud database MongoDB database vulnerable to high security risks. Use with caution.
Support for CIDR format, e.g., 10.23.12.24/24, where /24 indicates the length of the prefix in the address in the range [1, 32].
Separate multiple IP addresses or IP address ranges with commas (,).
Click OK.
Load ECS private IP addresses
Click Add Internal IP Addresses of ECS Instances in the Action column of the target group.
In IP Whitelist of the Import ECS Internal IP panel, select the ECS internal IP address to be added.
Click
. Click OK.
Next steps
After configuring the IP whitelist, you can connect to the MongoDB instance.