This topic describes how to configure a security group for an ApsaraDB RDS for MySQL instance. The RDS security group can be associated with an Elastic Compute Service (ECS) security group to allow all ECS instances in the ECS security group to access the RDS instance.

Prerequisites

Your RDS instance runs one of the following MySQL versions:
  • MySQL 8.0
  • MySQL 5.7
  • MySQL 5.6

Scenarios

After your RDS instance is created, you must configure IP address whitelists or security groups for the RDS instance for the specified devices to access the RDS instance. For more information about how to configure an IP address whitelist, see Configure an IP address whitelist for an ApsaraDB RDS for MySQL instance.

ECS security groups are used for access control of ECS instances in the security groups. For more information, see Create a security group.

Note You can configure both IP address whitelists and security groups for your RDS instance. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for MySQL instance. All the IP addresses in the configured IP address whitelists and all the ECS instances in the configured security groups are granted access to your RDS instance.

Usage notes

  • The security groups that you can add to your RDS instance must have the same network type as the instance. For example, if the network type of the instance is VPC, you can add only security groups whose network type is VPC to the instance.
  • After you change the network type of your RDS instance, the configured security groups become invalid. In this case, you must reconfigure the security groups with the new network type.
  • A maximum of 10 security groups are allowed per RDS instance.

Procedure

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Whitelist and SecGroup. On the page that appears, click the Security Group tab.
  3. Click Add Security Group.
    Note Security groups followed by a VPC tag contain ECS instances that reside in virtual private clouds (VPCs).
    Security Group
  4. Select the security group that you want to add, and then click OK.

What to do next

Create databases and accounts for an ApsaraDB RDS for MySQL instance

Related operations

Operation Description
DescribeSecurityGroupConfiguration Queries details about the ECS security groups that are associated with an instance.
ModifySecurityGroupConfiguration Modifies details about the ECS security groups that are associated with an instance.