Reviewed-by: Kucerak, Kristian <kristian.kucerak@t-systems.com> Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com> Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
35 KiB
Security Group Configuration Examples
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.
- Allowing External Access to a Specified Port
- Enabling ECSs in Different Security Groups to Communicate with Each Other Through an Internal Network
- Enabling Specified IP Addresses to Remotely Access ECSs in a Security Group
- Remotely Connecting to Linux ECSs Using SSH
- Remotely Connecting to Windows ECSs Using RDP
- Enabling Communication Between ECSs
- Hosting a Website on ECSs
- Enabling an ECS to Function as a DNS Server
- Uploading or Downloading Files Using FTP
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.
Allowing External Access to a Specified Port
Enabling ECSs in Different Security Groups to Communicate with Each Other Through an Internal Network
- Example scenario:
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.
- Security group configuration:
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
Enabling Specified IP Addresses to Remotely Access ECSs in a Security Group
- Example scenario:
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.
- Security group configuration:
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
Hosting a Website on ECSs
- Example scenario:
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.
- Security group rule:
Direction
Protocol
Port
Source
Inbound
HTTP
80
0.0.0.0/0
Inbound
HTTPS
443
0.0.0.0/0
Enabling an ECS to Function as a DNS Server
- Example scenario:
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.
- Security group rules:
Direction
Protocol
Port
Source
Inbound
TCP
53
0.0.0.0/0
Inbound
UDP
53
0.0.0.0/0