All Products
Search
Document Center

ApsaraDB RDS:Configure an IP address whitelist

Last Updated:Oct 19, 2026

After you create an RDS MySQL instance, add IP addresses to its whitelist so that the devices that use those IP addresses can access the RDS instance.

Prerequisites

You have created an ApsaraDB RDS for MySQL instance.

Procedure

Note

RDS has a default system whitelist that is not displayed and that allows system accounts to perform database maintenance operations. For details, see System accounts.

  1. Open the RDS instance list, select a region at the top, and then click the target instance ID.

  2. In the left-side navigation pane, click Whitelist and SecGroup.

  3. Confirm the IP address whitelist mode.

    Note

    Instances that run MySQL 5.5, 5.6, or 5.7 and use premium local SSDs can be switched to high-security mode. Instances with other versions or storage types use general mode.

  4. On the right side of the default group, click Modify. In the dialog box that appears, add IP addresses to the whitelist.

    Note
    • If necessary, you can also click Create Whitelist and specify a custom group name.

    • Groups are used only to manage IP addresses and do not affect actual access permissions. IP addresses in all groups have the same access permissions to the RDS instance.

    • Method 1: Add the IP address of the application server to the IP Addresses field. To view the IP address of the application server, see Appendix: How to get application server IP addresses. You can also click Load Local Public IP Address (If there is a network proxy on your PC, please turn it off first) to add the public IP address of your local device directly.

      Note
      • Separate multiple IP addresses with commas (,), and do not add spaces before or after the commas.

      • You can add a maximum of 1,000 IP addresses or CIDR blocks to a single instance. If you have many IP addresses, merge individual IP addresses into CIDR blocks, for example, 10.10.10.0/24.

      • If the whitelist mode is high-security mode, note the following:

        • Add public IP addresses to the Classic Network group.

        • Add the private IP addresses of ECS instances in VPCs to the VPC group.

    • Method 2: Click Load ECS private IP to display the IP addresses of all ECS instances in the current Alibaba Cloud account and region. You can then quickly add ECS private IP addresses to the whitelist. In the Whitelist Within Group transfer box, move the target IP addresses to the Configured list on the right, and then click OK to add the whitelist entries.

    Note

    The IP addresses that you must add to the whitelist differ depending on the compute resource that accesses RDS. Select the method that matches your situation:

    • Simple Application Server: Get the private IP address of the Simple Application Server and add it to the RDS whitelist.

    • ACK Serverless cluster: Pods access the Internet through a NAT gateway by default. Add the egress public IP address of the NAT gateway (you can view it in the SNAT entries of the NAT gateway console) to the RDS whitelist, instead of the private CIDR block of the cluster.

    • EMR and other clusters with dynamic IP addresses: Because source IP addresses change dynamically, configure the whitelist by CIDR block (in CIDR format, such as 10.0.0.0/16) to cover the possible IP address range and prevent access failures caused by IP address changes.

    • Cross-account ECS/VPC connectivity: Whether or not the access is cross-account, if the connectivity is over a private network such as Cloud Enterprise Network (CEN) or VPC peering, add the private IP address of the application-side ECS instance to the RDS whitelist.

    After you add the IP address, the application server can access the RDS instance.

  5. Click OK.

Best practices and security recommendations

  • Public network access security: Enabling a public endpoint creates a security risk. Strictly limit the whitelist to the public IP addresses required by your business, and do not use 0.0.0.0/0 to allow all IP addresses. If you detect a connection from an unexpected IP address, check whether it comes from a legitimate business host or whether a long-running transaction has not been released. If the host is not a business host, modify the whitelist policy immediately.

  • Brute-force attack protection: Use an IP address whitelist first to restrict access to trusted IP addresses. This reduces unauthorized connection attempts at the source. You can also use SSL encryption and password complexity policies to improve security.

  • VPC CIDR block configuration: If you add a large VPC CIDR block (such as 172.16.0.0/12) to the whitelist, all IP addresses in that CIDR block can access RDS. You do not need to add vSwitch CIDR blocks separately. To follow the principle of least privilege, remove the large CIDR block and specify the private IP addresses of specific ECS instances instead.

  • Separate internal and external network configuration: To leave private network access unrestricted and allow only specified public IP addresses, add the private VPC CIDR block to the private-network whitelist group, and add the specified public IP addresses to the public-network whitelist group.

Next steps

Connect to an RDS MySQL instance by CLI or client

References

FAQ

  • Q: Why can IP addresses that are not in the whitelist still access RDS?

    A: Check the following:

    • Check all whitelist groups to confirm whether they include 0.0.0.0/0. 0.0.0.0/0 allows all IP addresses to access RDS and poses a security risk. Delete it and allow only trusted IP addresses.

    • Check all security groups to confirm whether they include the IP address. If a security group includes the IP address, the address can access RDS.

  • Q: How can I access RDS from my computer without enabling Internet access?

    A: Establish a private network connection. For details, see Connect a VPC to a data center or another cloud.

  • Q: My application-side IP address keeps changing and I do not have a fixed IP address. How should I configure the whitelist for the RDS database?

    A: If you do not have a fixed IP address, do not set 0.0.0.0/0 (which allows all IP addresses to access RDS and is not recommended for security reasons). Use identity-based access control instead of IP-based access control. For example, use the following methods:

    • Use a dynamic DNS service: Use dynamic DNS to get the domain name that corresponds to the dynamic IP address, and add the domain name or its resolved IP address to the database whitelist.

    • Configure a reverse proxy or a load balancer: Forward all application requests from the user side to the database through a reverse proxy server or a load balancer, and add only the fixed IP address of the proxy server to the database whitelist.

    • Update the whitelist regularly: If IP addresses change within a certain range (such as home broadband IP addresses assigned by an ISP), get these IP addresses regularly and update the whitelist.

  • Q: Why does adding a whitelist in the RDS console return the error InvalidSecurityIPListLength.Malformed?

    Issue description

    When you add a whitelist in the RDS console, the following error may occur:

    Error code: InvalidSecurityIPListLength.Malformed
    Error message (Chinese): The security IP address is not in the available range or is already occupied.
    Error message (English): The security ip address is not in the available range or occupied.

    Solution

    • Cause 1: A single whitelist group supports a maximum of 1,000 IP addresses or CIDR blocks, and the newly added IP addresses exceed this limit.

      Solution: Make sure that a single whitelist group contains no more than 1,000 IP addresses or CIDR blocks. Merge individual IP addresses into CIDR blocks (such as 192.168.1.0/24) to reduce the number of entries.

    • Cause 2: The IP address whitelist that you added contains invalid addresses.

      Solution: Make sure that the IP addresses you enter are valid. Use the standard CIDR format (such as 10.23.12.0/24), with a mask in the range of 1 to 32. To add multiple IP addresses, separate them with commas (,).

    • Cause 3: The added whitelist conflicts with an existing whitelist. For example, in RDS MySQL, 192.168.1.8 conflicts with 192.168.1.1/8.

      Solution: Plan and add whitelist entries based on your actual requirements to avoid overlaps or conflicts with existing rules.

    Note

    Do not delete the default group default (which contains 127.0.0.1), and do not modify system groups (such as ali_dms_group or hdm_security_ips), to avoid affecting system functions or connection security.

Appendix: Check whether your application can connect to the RDS instance over an internal network

  1. View the region and network type of the ECS instance on which your application is deployed. For more information, see Get ready to use ApsaraDB RDS.

  2. View the region and network type of the RDS instance.

    Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance. On the page that appears, you can view the region, network type, and VPC ID of the RDS instance.RDS实例地域和网络类型

  3. Check whether the ECS instance and the RDS instance meet the following conditions for communication over an internal network:

    1. The ECS instance and the RDS instance reside in the same region.

    2. The ECS instance and the RDS instance reside in the same type of network. If the ECS instance and the RDS instance both reside in VPCs, these instances reside in the same VPC.

    Note

    If one of the preceding conditions is not met, the ECS instance cannot communicate with the RDS instance over an internal network.

Appendix: How to get application server IP addresses

Table 1. How to get application server IP addresses

Scenario

Required IP address

How to get it

Private network access requirements are met

IP address of the container in an ACK cluster

  • If the ACK cluster's container network plugin is Flannel, add the IP address of the node where the application runs.

  • If the ACK cluster's container network plugin is Terway, add the IP address of the pod where the application runs.

On the Pod page of the target ACK cluster, view the pod IP addresses and node IP addresses.

Private IP address of an ECS instance

Open the ECS instance list, select a region, and view the private and public IP addresses in the instance list.

Private network access requirements are not met

Public IP address of an ECS instance

You need to access the RDS instance from a local device

Public IP address of the local device

Run curl ipinfo.io/ip (recommended) or curl ifconfig.me to query the public IP address of the local client.

Note

A public IP address may change during database upgrades or configuration changes. If you have added the local IP address to the whitelist but still cannot connect, see Find your public IP for ApsaraDB RDS connections for troubleshooting.

Appendix: System default whitelists

When the DMS, DTS, and DAS services interact with RDS MySQL, the system automatically adds the following whitelist groups to ensure normal access.

Group name

Description

dms

Used by DMS to log on to RDS MySQL instances.

dts

Used by DTS to transfer data.

hdm_security_ips

Used by DAS for data collection, optimization, operations and maintenance, and security management.

Important

For instances created after December 2020, the hdm_security_ips whitelist group is not visible to users, which prevents accidental modification or deletion of the group that could affect the use of related services.