This topic describes how to configure an IP address whitelist for an ApsaraDB RDS for PostgreSQL instance. After you create an RDS instance, you must configure IP address whitelists or security groups for the RDS instance. Otherwise, the RDS instance is inaccessible.
Scenarios
An IP address whitelist consists of IP addresses and CIDR blocks that are granted access to the RDS instance. You can configure IP address whitelists for an RDS instance to provide high-level access control and security protection for the RDS instance. We recommend that you update the configured IP address whitelists regularly.
You need to configure an IP address whitelist in the following scenarios:
Scenario 1: After you create an RDS instance, you must add external IP addresses to an IP address whitelist. Otherwise, external devices cannot access the RDS instance.
Scenario 2: When a database connection exception occurs, you can check whether the IP address whitelist is correctly configured.
The following table provides the IP address whitelist configurations in various connection scenarios.
Connection scenario | Network type | IP address whitelist configuration |
Connect an Elastic Compute Service (ECS) instance to an RDS instance | The ECS instance and the RDS instance reside in the same virtual private cloud (VPC) (recommended) | Add the private IP address of the ECS instance to an IP address whitelist of the RDS instance. |
The ECS instance and the RDS instance reside in different VPCs | Instances in different VPCs cannot communicate with each other over internal networks. In this case, perform the following operations:
| |
Connect a container in an ACK cluster to an RDS instance | The ACK cluster and the RDS instance reside in the same VPC (recommended) |
You can view the pod IP address and node IP address on the pod page of the ACK cluster. |
The ACK cluster and the RDS instance reside in different VPCs | Instances in different VPCs cannot communicate with each other over internal networks. In this case, perform the following operations:
| |
Connect a self-managed host outside the cloud to an RDS instance | None | Add the public IP address of the self-managed host to an IP address whitelist of the RDS instance.
|
Limits
A maximum of 50 IP address whitelists can be configured for an RDS instance.
If you configure IP address whitelists for your RDS instance, the workloads on the instance are not affected.
IP address whitelist groups are used only for IP address management. They do not affect the actual access permissions. All IP addresses in all IP address whitelist groups have the same access permissions to the RDS instance.
The whitelist labeled default can be cleared, but cannot be deleted.
Do not modify or delete the IP address whitelists that are generated for other Alibaba Cloud services. If you delete these IP address whitelists, the related Alibaba Cloud services cannot connect to your ApsaraDB RDS instance. For example, do not modify or delete ali_dms_group (the IP address whitelist group for DMS) or hdm_security_ips (the IP address whitelist group for DAS).
ImportantTo prevent accidental modifications or deletions of IP address whitelist groups, the hdm_security_ips IP address whitelist group is invisible to users for instances that are created after December 2020.
The default IP address whitelist contains only 127.0.0.1, which indicates that no IP addresses except the local IP address 127.0.0.1 can access the RDS instance.
Configure a standard IP address whitelist
Visit the RDS Instances page, select a region at the top of the page, and then click the ID of the target instance.
In the navigation pane on the left, click Whitelists and Security Groups.
Click Create Whitelist, enter a Group Name, or click Modify for an existing IP address whitelist group.
Enter the IP addresses or CIDR blocks that need to access the RDS instance, and then click OK.
ImportantSeparate multiple IP addresses or CIDR blocks with commas (,). Do not add spaces before or after the commas. Example:
192.168.0.1,172.16.213.9
.A maximum of 1,000 IP addresses and CIDR blocks can be configured for each RDS instance. To specify many IP addresses, we recommend that you combine the IP addresses into CIDR blocks, such as
10.10.10.0/24
.
(Optional) If the current instance has read-only instances, you can configure the Synchronize Whitelist to Read-only Instances parameter to synchronize the IP address whitelist of the primary instance to the specified read-only instances. If multiple read-only RDS instances are attached to the RDS instance, you can select more than one read-only RDS instance for synchronization.
(Optional) Click Load ECS Internal IP Addresses to display the IP addresses of all ECS instances that belong to your Alibaba Cloud account. You can quickly add the private IP addresses of the ECS instances to the IP address whitelist.
Configure an enhanced IP address whitelist
Cloud disk instances do not support the enhanced whitelist mode. High-performance local disk storage is no longer available for purchase.
The enhanced whitelist mode distinguishes between the classic network and VPCs. You must specify a network isolation mode for each IP address whitelist group. For example, IP addresses in an IP address whitelist for the classic network cannot be used to access the RDS instance over VPCs, and vice versa.
If your high-performance local disk instance is already in enhanced whitelist mode, follow the instructions in this section. To switch to enhanced whitelist mode, see Switch to enhanced whitelist mode.
Visit the RDS Instances page, select a region at the top of the page, and then click the ID of the target instance.
In the navigation pane on the left, click Whitelists and Security Groups.
Click Create Whitelist and select a Network Isolation Mode.
Enter a Group Name.
In the IP Addresses field, enter the IP addresses or CIDR blocks that need to access the RDS instance, and then click OK.
ImportantSeparate multiple IP addresses or CIDR blocks with commas (,). Do not add spaces before or after the commas. Example:
192.168.0.1,172.16.213.9
.A maximum of 1,000 IP addresses and CIDR blocks can be configured for each RDS instance. To specify many IP addresses, we recommend that you combine the IP addresses into CIDR blocks, such as 10.10.10.0/24.
(Optional) If the current instance has read-only instances, you can configure the Synchronize Whitelist to Read-only Instances parameter to synchronize the IP address whitelist of the primary instance to the specified read-only instances. If multiple read-only RDS instances are attached to the RDS instance, you can select more than one read-only RDS instance for synchronization.
(Optional) Click Load ECS Internal IP Addresses to display the IP addresses of all ECS instances that belong to your Alibaba Cloud account. You can quickly add the private IP addresses of the ECS instances to the IP address whitelist.
NoteIf the enhanced whitelist mode is enabled for the RDS instance, you must select a network isolation mode.
What to do next
FAQ
Related API operations
You can call the API operation DescribeDBInstanceIPArrayList to view the IP address whitelists of an RDS instance.
You can call the API operation ModifySecurityIps to modify the IP address whitelists of an RDS instance.