You have a security group with the following inbound rule:
Type: SSH
Protocol: TCP
Port Range: 22
Source: 0.0.0.0/0
What does this rule allow?
Think about what 0.0.0.0/0 means in networking.
The source 0.0.0.0/0 means any IP address. So this rule allows SSH (port 22) from anywhere to the instances.
You create a security group with no outbound rules. What will be the effect on instances using this security group?
Remember the default behavior of outbound rules in AWS security groups.
By default, security groups allow all outbound traffic. But if you remove all outbound rules, no outbound traffic is allowed.
You want to create a security group for a web server that:
- Allows HTTP traffic from anywhere
- Allows SSH only from a specific office IP 203.0.113.5
- Blocks all other traffic
Which inbound rule set correctly implements this?
Think about which ports and sources are allowed for HTTP and SSH.
HTTP (port 80) must be open to all IPs (0.0.0.0/0). SSH (port 22) must be restricted to the office IP (203.0.113.5/32). All other traffic is blocked by default.
You have two inbound rules in a security group:
- Allow TCP port 443 from 192.168.1.0/24
- Deny TCP port 443 from 192.168.1.50/32
What will happen when a request comes from 192.168.1.50 on port 443?
Consider how AWS security groups handle deny rules.
AWS security groups only have allow rules. There are no deny rules. So the request from 192.168.1.50 is allowed because it matches the allow rule.
You modify the inbound rules of a security group attached to running instances by removing a rule that allowed port 3306 (MySQL) from a specific IP range.
What happens immediately after this change?
Think about how security groups apply changes to network traffic.
Security group changes apply immediately to new connections. Existing connections remain until closed.