Network ACL Structure and Subnet Association
What you'll learn: How Network ACLs (NACLs) attach to subnets and use numbered rules to create stateless firewall controls at the subnet boundary.
What is a Network ACL?
A Network ACL is a stateless firewall that operates at the subnet level in your VPC. Unlike security groups that protect individual resources, a NACL acts as a gatekeeper for an entire subnet—every packet entering or leaving the subnet must pass through the NACL first.
Subnet Association Model
Each subnet in your VPC must be associated with exactly one NACL. Think of it like assigning a security checkpoint to a neighborhood—you can't have a neighborhood without one, and you can't have two checkpoints controlling the same entrance. Multiple subnets can share the same NACL, but each subnet can only have one NACL at a time.
Numbered Rules and Evaluation
NACLs use numbered rules (typically 100, 200, 300, etc.) that are evaluated in ascending order. The first rule that matches the traffic wins—no further rules are checked. This is like a bouncer working down a checklist: first match = final decision.
Each rule specifies:
- Rule number (1-32766)
- Protocol (TCP, UDP, ICMP, or all)
- Port range
- Source/destination CIDR
- Allow or Deny action
Default NACL Behavior
When you create a new VPC, AWS automatically creates a default NACL that allows all inbound and outbound traffic. It's completely permissive—essentially no protection. Custom NACLs, by contrast, start by denying all traffic until you explicitly add allow rules.
Every NACL ends with an implicit "deny all" rule (rule *) that catches anything not explicitly allowed.
Key Takeaway: Network ACLs provide stateless, subnet-level filtering using numbered rules evaluated in order, with each subnet requiring exactly one NACL association—default NACLs allow everything while custom NACLs deny everything by default.