After creating an ApsaraDB for MongoDB instance, configure an IP address whitelist or a security group for the instance to allow external devices to connect. By default, the whitelist contains only 127.0.0.1, which blocks all external access. This topic describes how to configure an IP address whitelist.
Prerequisites
The instance endpoints appear on the Basic Information and Database Connections pages only after you configure a whitelist. You must configure the whitelist before first use.
-
An ApsaraDB for MongoDB instance
-
The instance ID and the region where the instance resides
Usage notes
-
Maintain your IP address whitelists regularly to keep your MongoDB instances secure.
-
The default whitelist is created by the system. You can edit it, but you cannot delete it. For details about other whitelist names and sources, see How do I understand the names and sources of an IP address whitelist for ApsaraDB for MongoDB?
Procedure
-
Go to the Replica Set Instances or Sharded Cluster Instances page.
-
In the top navigation bar, select the region and resource group of your instance. Then, click the instance ID.
-
In the left-side navigation pane, choose .
-
Click Create Whitelist.
-
In the Create Whitelist panel, configure the following settings:
-
Enter a whitelist name.
The name must be 2 to 32 characters in length, start with a lowercase letter, end with a lowercase letter or digit, and contain only lowercase letters, digits, and underscores (_).
-
Select the IPv4 or IPv6 tab based on the IP address type.
NoteIPv6 is supported only by instances that run MongoDB 4.2.
-
In the IP Whitelist field, add IP addresses.
Separate multiple entries with commas (,). A maximum of 1,000 entries can be added per whitelist.
IP version
Supported formats
Example
IPv4
Individual IP addresses
10.23.12.24IPv4
CIDR blocks (prefix length: 1 to 32)
10.23.12.24/24IPv6
Individual IP addresses
--
WarningIf the whitelist contains only
0.0.0.0/0or is empty, all IP addresses can access the instance. This poses a security risk. Proceed with caution.
-
-
Click OK.