A security group is a collection of access control rules to control the traffic that is allowed to reach and leave the cloud resources that it is associated with. The cloud resources can be cloud servers, containers, databases, and more. Cloud resources associated with the same security group have the same security requirements and are mutually trusted within a VPC. A security group consists of inbound and outbound rules.
Each ECS must be associated with at least one security group. If you do not have a security group when creating an ECS, the system provides a default security group.
If an inbound request matches the source in an inbound security group rule, the request is allowed and other requests are denied.
By default, you do not need to configure deny rules in the inbound direction because requests that do not match allow rules will be denied.
If the destination of an outbound security group rule is 0.0.0.0/0, all outbound requests are allowed.
0.0.0.0/0 represents all IPv4 addresses.
::/0 represents all IPv6 addresses.
If the rules of the security group associated with your instance cannot meet your requirements, for example, you need to allow inbound traffic on a specific TCP port, you can add an inbound rule to allow traffic on the TCP port.
The Virtual Private Cloud page is displayed.
The security group list is displayed.
The page for configuring security group rules is displayed.
The Add Inbound Rule dialog box is displayed.
You can click + to add more inbound rules.
Parameter |
Description |
Example Value |
---|---|---|
Protocol |
The network protocol used to match traffic in a security group rule. Currently, the value can be All, TCP, UDP, GRE, ICMP, or more. |
TCP |
Port |
The port or port range over which traffic can reach your ECS. The value can be from 1 to 65535. |
22, or 22-30 |
Type |
Source IP address version. You can select:
|
IPv4 |
Source |
Source of the security group rule. The value can be an IP address or a security group to allow access from IP addresses or instances in the security group.
If the source is a security group, this rule will apply to all instances associated with the selected security group. |
0.0.0.0/0 |
Description |
Supplementary information about the security group rule. This parameter is optional. The security group rule description can contain a maximum of 255 characters and cannot contain angle brackets (< or >). |
N/A |
The inbound rule list is displayed.
The Add Outbound Rule dialog box is displayed.
You can click + to add more outbound rules.
Parameter |
Description |
Example Value |
---|---|---|
Protocol |
The network protocol used to match traffic in a security group rule. Currently, the value can be All, TCP, UDP, GRE, ICMP, or more. |
TCP |
Port |
The port or port range over which traffic can leave your ECS. The value can be from 1 to 65535. |
22, or 22-30 |
Type |
Source IP address version. You can select:
|
IPv4 |
Destination |
Destination of the security group rule. The value can be an IP address or a security group to allow access to IP addresses or instances in the security group.
|
0.0.0.0/0 |
Description |
Supplementary information about the security group rule. This parameter is optional. The security group rule description can contain a maximum of 255 characters and cannot contain angle brackets (< or >). |
N/A |
The outbound rule list is displayed.