Cloud Network
Controls
Understand how Security Groups and Network ACLs protect cloud resources by filtering traffic at different layers of your virtual network.
What Is a Virtual Network?
When you deploy servers in the cloud, they don't sit on a physical wire you can touch. Instead, the cloud provider creates a Virtual Private Cloud (VPC): your own isolated section of the cloud with its own IP address range, subnets, and routing rules.
Why Network Controls Matter
In a physical data center, you have physical firewalls and routers. In the cloud, those are replaced by virtual network controls that you configure through software. They are your first line of defense.
The Two Main Controls
Cloud providers (AWS, Azure, GCP) all offer two layers of network filtering. In AWS terminology, they are called Security Groups and Network Access Control Lists (NACLs).
Security Groups: Instance-Level Firewall
NACLs: Subnet-Level Filter
Security Group vs NACL
| Security Group | Network ACL | |
|---|---|---|
| Level | Instance | Subnet |
| State | Stateful | Stateless |
| Rule Types | Allow only | Allow and Deny |
| Rule Processing | All rules evaluated | Ordered: first match wins |
| Default Behavior | Deny all inbound | Allow all traffic |
| Applied To | Assigned to instance | Auto-applies to entire subnet |
Defense in Depth
How to Configure Controls
Example: Web Server Security Group
A company wants to host a public website. They need to allow HTTPS traffic from the internet while blocking everything else.
| Direction | Protocol | Port | Source / Dest |
|---|---|---|---|
| Inbound | TCP | 443 | 0.0.0.0/0 |
| Inbound | TCP | 80 | 0.0.0.0/0 |
| Outbound | All | All | 0.0.0.0/0 |
Example: Database Security Group
The database server should only accept connections from the web servers, never directly from the internet. We reference the Web Server Security Group as the source.
| Direction | Protocol | Port | Source |
|---|---|---|---|
| Inbound | TCP | 5432 | sg-webserver |
| Outbound | All | All | 0.0.0.0/0 |
Example: NACL for Public Subnet
Since NACLs are stateless and use numbered rule ordering, we must carefully define both inbound and outbound rules.
| Rule # | Direction | Port | Action |
|---|---|---|---|
| 100 | Inbound | 443 | Allow |
| 200 | Inbound | 80 | Allow |
| * | Inbound | All | Deny |
| 100 | Outbound | 1024-65535 | Allow |
| * | Outbound | All | Deny |
Stateful vs Stateless
Rule Processing Order
Common Mistakes
Summary at a Glance
| Feature | Security Group | Network ACL |
|---|---|---|
| Operates At | Instance (ENI) | Subnet |
| Stateful? | Yes | No |
| Supports Deny? | No | Yes |
| Rule Processing | All evaluated | First match wins |
| Default | Deny all in, Allow all out | Allow all in and out |
| Best For | Per-app access control | Subnet-wide blocking |
Question 1 of 5
A Security Group is stateful. What does this mean in practice?
Question 2 of 5
A NACL has these inbound rules:
Rule 100: Allow TCP port 80
Rule 150: Deny all traffic
Rule 200: Allow TCP port 443
What happens to HTTPS (port 443) traffic?
Question 3 of 5
You configure a NACL to allow inbound traffic on port 443, but clients cannot receive responses. What is the most likely cause?
Question 4 of 5
Which of the following is a key difference between Security Groups and NACLs?
Question 5 of 5
A database server should only accept connections from web servers. What is the most secure way to configure the database Security Group?