Common security group configurations are presented here. The examples in this section allow all outgoing data packets by default. This section will only describe how to configure inbound rules.
You can use the default security group or create a security group in advance. For details, see sections Creating a Security Group and Adding a Security Group Rule.
Resources on an ECS in a security group need to be copied to an ECS associated with another security group. The two ECSs are in the same VPC. We recommend that you enable private network communication between the ECSs and then copy the resources.
Within a given VPC, ECSs in the same security group can communicate with one another by default. However, ECSs in different security groups cannot communicate with each other by default. To enable these ECSs to communicate with each other, you need to add certain security group rules.
You can add an inbound rule to the security groups containing the ECSs to allow access from ECSs in the other security group. The required rule is as follows.
Direction |
Protocol/Application |
Port |
Source |
---|---|---|---|
Inbound |
Used for communication through an internal network |
Port or port range |
ID of another security group |
To prevent ECSs from being attacked, you can change the port for remote login and configure security group rules that allow only specified IP addresses to remotely access the ECSs.
To allow IP address 192.168.20.2 to remotely access Linux ECSs in a security group over the SSH protocol (port 22), you can configure the following security group rule.
Direction |
Protocol |
Port |
Source |
---|---|---|---|
Inbound |
SSH |
22 |
IPv4 CIDR block or ID of another security group For example, 192.168.20.2/32 |
If you deploy a website on your ECSs and require that your website be accessed over HTTP or HTTPS, you can add rules to the security group used by the ECSs that function as the web servers.
Direction |
Protocol |
Port |
Source |
---|---|---|---|
Inbound |
HTTP |
80 |
0.0.0.0/0 |
Inbound |
HTTPS |
443 |
0.0.0.0/0 |
If you need to use an ECS as a DNS server, you must allow TCP and UDP access from port 53 to the DNS server. You can add the following rules to the security group associated with the ECS.
Direction |
Protocol |
Port |
Source |
---|---|---|---|
Inbound |
TCP |
53 |
0.0.0.0/0 |
Inbound |
UDP |
53 |
0.0.0.0/0 |
If you want to use File Transfer Protocol (FTP) to upload files to or download files from ECSs, you need to add a security group rule.
You must first install the FTP server program on the ECSs and check whether ports 20 and 21 are working properly.
Direction |
Protocol |
Port |
Source |
---|---|---|---|
Inbound |
TCP |
20-21 |
0.0.0.0/0 |