Skip to main content
In this lesson you’ll learn the differences between Network ACLs (NACLs) and Security Groups in AWS, how they behave, and when to use each to protect resources inside a VPC.

What is a Network ACL (NACL)?

A Network Access Control List (NACL) is a stateless, subnet-level firewall for your VPC. NACLs control traffic entering and leaving a subnet and can be associated with one or more subnets in the same VPC. Because they are associated at the subnet level, a single NACL can be reused across multiple subnets that require the same traffic controls. Each NACL contains an ordered list of rules. Each row in a NACL rule table contains:
  • Rule number (priority — lower numbers are evaluated first)
  • Type (protocol/service)
  • Protocol (TCP/UDP/ICMP/All)
  • Port range
  • Source or destination (CIDR)
  • Action (Allow or Deny)
NACLs evaluate rules in ascending order and apply the first matching rule. If no rule matches the traffic, there is an implicit deny.
Screenshot of a "Default NACL" inbound rules table showing two entries: rule 100 allows all traffic from 0.0.0.0/0, and the "*" rule denies all traffic from 0.0.0.0/0. The panel shows columns for type, protocol, port range, source, and Allow/Deny with green Allow and red Deny icons.
The image above illustrates a default NACL rule set: by default a newly created VPC and subnets receive a default NACL that allows all inbound and outbound traffic. You can modify these default rules or replace the NACL to restrict traffic as needed.

Two primary AWS firewall mechanisms

  • NACLs: operate at the subnet level — filter traffic entering and leaving subnets (stateless).
  • Security Groups: operate at the resource (ENI/instance) level — control inbound and outbound traffic for the resource (stateful).
A diagram titled "Security Group vs NACL" showing an AWS VPC with two Availability Zones, each containing public and private subnets with EC2 instances protected by security groups. A central ACLs box is depicted controlling traffic for subnet CIDR blocks (172.16.0.0, 172.16.1.0, 172.16.2.0) between the VPC edge and the subnets.

Key behavioral differences (at a glance)

Exam tip: Remember “NACL = stateless, numbered rules, allow and deny” and “Security Group = stateful, no deny rules, rules are permissive only.”

Security Groups — deeper dive

Security groups act as virtual firewalls attached to resources (EC2, ENIs, etc.) to control inbound and outbound traffic. They are stateful: if an inbound packet is allowed, the response is automatically allowed as part of the same connection. Key points:
  • A single security group can be attached to multiple instances to simplify management (e.g., one security group for all web servers).
  • A single instance can have multiple security groups attached; effective permissions are the union of their allow rules.
  • Security groups are scoped to a VPC — you cannot attach a security group from another VPC directly.
  • Rules are defined as separate Inbound and Outbound sections and include protocol, port range, and source/destination (CIDR or another security group).
A network diagram titled "Security Group – Introduction" showing a VPC with two availability zones, each containing a public and private subnet with EC2 instances. A dotted line labeled "Security Group" connects the EC2 instances across the zones.
Example inbound rule (common example, not recommended for production): allow SSH from anywhere.
A screenshot of a cloud console page titled "Inbound and Outbound Rules" showing an inbound security group rule for SSH (TCP port 22) with the source set to 0.0.0.0/0. An orange app-like icon and form fields for adding rules are also visible.
Outbound rules are defined in the same format but control egress traffic originating from the instance.
A webpage screenshot titled "Inbound and Outbound Rules" with a pink mail/reply icon near the top. Below it is an "Outbound rules" panel showing a security group entry set to "All traffic" to destination 0.0.0.0/0 with an "Add rule" button.

Services exempt from security group filtering

Certain AWS-managed endpoints or services are not filtered by security groups; traffic to and from these services is allowed regardless of security group rules. Examples include:
  • Amazon DNS servers
  • Amazon DHCP
  • EC2 instance metadata service
  • ECS task metadata endpoints
  • Windows license activation services
  • Amazon Time Sync Service
  • Reserved IP addresses used by the default VPC router
A slide titled "Security groups do not filter traffic destined to and from the following" showing icon tiles of AWS endpoints. It lists Amazon Domain Name Services (DNS), DHCP, EC2 instance metadata, ECS task metadata endpoints, Windows license activation, Amazon Time Sync Service, and reserved VPC router IPs.

Practical guidance and troubleshooting

  • Default behaviors:
    • Default NACL: allows all inbound and outbound traffic until you modify it.
    • New custom security group: denies all inbound traffic and allows all outbound traffic by default.
  • When to use which:
    • Use NACLs for broad, stateless subnet-level controls or to quickly block entire IP ranges.
    • Use Security Groups for stateful, resource-level, fine-grained access control.
  • Troubleshooting checklist:
    1. Check the instance’s security group inbound/outbound rules.
    2. Check the subnet’s NACL inbound/outbound rules.
    3. Verify routing and network ACL rule ordering (remember numbered NACL rules).
    4. Confirm there are no other network appliances (NAT, firewalls) blocking traffic.
    5. Check whether traffic involves exempted AWS endpoints (these bypass security groups).
This lesson covered the core differences, default behaviors, rule evaluation, and recommended use cases for NACLs and Security Groups so you can design secure and predictable networking controls in your VPC.

Watch Video