Skip to main content
← Blog

Compared · SAA-C03 · SOA-C03 · CLF-C02

Security Groups vs Network ACLs

Two firewalls in every VPC, with opposite rules about state, deny rules and evaluation order. Most exam questions turn on exactly one of those differences.

Published

The short answer: a security group is a stateful firewall attached to an instance (strictly, its network interface) that only has allow rules. A network ACL is a stateless filter on a subnet boundary that has both allow and deny rules, evaluated in number order. Because security groups are stateful, return traffic is allowed automatically; because NACLs are stateless, you must allow the response traffic yourself, usually on the ephemeral port range. AWS calls security groups the primary control and NACLs an optional second layer.

Side by side

Security groupNetwork ACL
Applies toInstances (network interfaces) it is associated withEvery instance in the subnets it is associated with
StateStateful: responses allowed automaticallyStateless: responses need their own rule
Rule typesAllow onlyAllow and deny
EvaluationAll rules evaluated before decidingLowest rule number first; first match wins
Can referenceCIDRs, prefix lists, other security groupsCIDRs
How many per resourceSeveral per network interface; rules are combinedExactly one per subnet; one NACL can cover many subnets
Default behaviourNew group: no inbound, all outboundDefault NACL: allow all. Custom NACL: deny all until you add rules

The first four rows are AWS's own comparison table; the rest are from the security group and network ACL pages linked under Sources.

How security groups behave

A security group acts as a virtual firewall for the resources associated with it. Its rules can only allow traffic: there is no deny rule, so anything not allowed is dropped. A brand-new group has no inbound rules, so nothing gets in, and one outbound rule that allows everything out. If you attach several groups to one network interface, AWS combines their rules into a single set.

Being stateful is the property everything else follows from. If inbound HTTPS is allowed, the response leaves regardless of the outbound rules; if the instance starts a connection out, the reply comes back regardless of the inbound rules.

The feature architects lean on is security group referencing: a rule's source can be another security group instead of an IP range. The standard three-tier layout uses it. The load balancer's group allows 443 from the internet, the web tier's group allows traffic only from the load balancer's group, and the database group allows its port only from the web tier's group. Instances can come and go without anyone editing an IP list.

How network ACLs behave

Every subnet is associated with exactly one network ACL; if you don't pick one, it uses the VPC's default. Each rule has a number from 1 to 32766, and AWS evaluates them from the lowest number up, applying the first rule that matches and ignoring the rest. Every NACL ends with an unchangeable * rule that denies anything no numbered rule matched.

The default NACL that comes with a VPC allows all inbound and outbound traffic, which is why many people never notice NACLs exist. A custom NACL you create has only the deny-all * rules until you add your own.

NACLs filter traffic as it enters and leaves the subnet, not traffic between instances inside the same subnet. And because they are stateless, every allowed request needs a matching rule for its response. Responses go to the client's ephemeral port, which depends on the client: AWS lists 32768-61000 for many Linux kernels, 49152-65535 for Windows Server 2008 and later, and 1024-65535 for NAT gateways, Elastic Load Balancing and Lambda. In practice AWS suggests opening 1024-65535 for public-facing subnets and placing any deny rules for specific ports in that range before the broad allow.

When to use which

  • Allow the right traffic to an application tier: security groups, ideally referencing each other between tiers.
  • Block one IP address or range: a NACL deny rule. Security groups can't deny, and you can't carve an exception out of a broad allow with them.
  • A subnet-wide guard rail: a NACL, for example to make sure a database subnet never accepts traffic from the internet even if someone attaches a too-open security group. AWS describes NACLs as defence in depth for exactly this case.
  • Day to day: leave NACLs at their defaults unless you need a deny or a guard rail. Every custom NACL rule needs its response rule too, which is where most outages come from.

Exam traps

  • Swapped properties. The most common wrong option simply reverses one attribute: "security groups are stateless", "NACLs operate at the instance level". Learn the pairs as a block: security group = instance, stateful, allow only, all rules; NACL = subnet, stateless, allow and deny, numbered order.
  • A deny rule in a security group. Any option that adds a "Deny" to a security group is wrong, because the feature doesn't exist.
  • Rule numbers. A NACL deny added with a higher number than an existing allow never fires for traffic the allow already matches. The deny has to come first.
  • Missing outbound ephemeral rule. Inbound 443 is allowed everywhere, yet clients time out. If flow logs show the inbound packet accepted and the reply rejected, the culprit is the stateless NACL, not the stateful security group.
  • Filtering vs routing. Neither one makes a subnet public or private. If an instance with a public IP can't be reached and both firewalls allow the traffic, look at the route table for a route to an internet gateway.
  • IAM as a network control. IAM policies authorise API calls. They don't filter packets reaching an instance.

Practice questions from our bank

One question each from our SAA-C03, SOA-C03 and CLF-C02 banks. Try each before opening the answer.

  1. Question 1 · SAA-C03 · Design Secure Architectures

    A public subnet hosts web servers. Its network ACL has inbound rule 100, which allows TCP 443 from 0.0.0.0/0. During an incident, the security team must immediately stop all inbound traffic from one attacker IP address to every instance in the subnet, while HTTPS from everyone else continues. Which action meets this requirement?

    • AAdd an inbound network ACL rule numbered 90 that denies all traffic from the attacker's /32
    • BAdd an inbound network ACL rule numbered 200 that denies all traffic from the attacker's /32
    • CAdd an inbound rule with a Deny action for the attacker's /32 to the web servers' security group
    • DAttach an IAM policy that denies requests where aws:SourceIp matches the attacker's /32
    Show answer and explanation

    Answer: A) Add an inbound network ACL rule numbered 90 that denies all traffic from the attacker's /32

    Only network ACLs can explicitly deny traffic at the subnet level, and because evaluation stops at the first matching rule, the deny must have a lower rule number than the existing allow. Security groups are allow-only, and IAM doesn't filter network traffic.

    • ANetwork ACL rules can allow or deny and are evaluated in ascending rule-number order, and the first match is applied. Rule 90 is evaluated before the allow in rule 100, so packets from the attacker are dropped at the subnet boundary while other HTTPS traffic still matches rule 100.
    • BThe attacker's HTTPS traffic matches the allow in rule 100 first. Evaluation stops at the first match, so a deny with a higher rule number is never reached for that traffic.
    • CSecurity groups support allow rules only, not deny rules. You can't use a security group to exclude one address from a broader allowed range.
    • DIAM policies authorize AWS API requests made by principals. They don't filter network packets that arrive at instances in a subnet.
  2. Question 2 · SOA-C03 · Networking and Content Delivery

    Clients on the internet can't load a website on an EC2 instance in a public subnet. VPC flow logs for the instance's network interface show an inbound record from a client's port 52814 to the instance's port 443 with ACCEPT, and an outbound record from the instance's port 443 to the client's port 52814 with REJECT. What is the most likely cause?

    • AThe security group has no outbound rule for ports 1024–65535
    • BThe network ACL has no outbound rule for ephemeral ports 1024–65535
    • CThe subnet's route table has no 0.0.0.0/0 route to the internet gateway
    • DThe operating system firewall on the instance drops the replies
    Show answer and explanation

    Answer: B) The network ACL has no outbound rule for ephemeral ports 1024–65535

    Inbound ACCEPT with outbound REJECT on the reply points to a stateless network ACL that is missing an outbound ephemeral-port rule.

    • AIncorrect. Security groups are stateful. Once inbound traffic is allowed, the response is allowed automatically, whatever the outbound rules say.
    • BCorrect. Network ACLs are stateless, so return traffic must be allowed separately. The response goes to the client's ephemeral port (52814), and without an outbound rule for that range the ACL rejects it.
    • CIncorrect. A missing route wouldn't show up as REJECT in flow logs. Flow logs record REJECT when a security group or network ACL blocks traffic.
    • DIncorrect. Flow logs only record decisions made by security groups and network ACLs. A reply dropped by the OS would never leave the instance, so no outbound REJECT record would appear.
  3. Question 3 · CLF-C02 · Security and Compliance

    A company uses both security groups and network ACLs to control traffic in its VPC. Which statement correctly compares the two?

    • ASecurity groups are stateful and operate at the instance level; network ACLs are stateless and operate at the subnet level
    • BSecurity groups are stateless and operate at the subnet level; network ACLs are stateful and operate at the instance level
    • CSecurity groups support both allow and deny rules; network ACLs support allow rules only
    • DBoth evaluate their rules in numbered order and stop at the first rule that matches the traffic
    Show answer and explanation

    Answer: A) Security groups are stateful and operate at the instance level; network ACLs are stateless and operate at the subnet level

    Security groups are stateful, allow-only firewalls at the instance level that evaluate all rules. Network ACLs are stateless subnet-level controls with allow and deny rules, evaluated in number order.

    • ACorrect. Security groups allow return traffic automatically (stateful) and apply to instances. Network ACLs require return traffic to be allowed explicitly (stateless) and apply to every instance in the associated subnets.
    • BIncorrect. This reverses both properties. Security groups are stateful and work at the instance level, while network ACLs are stateless and work at the subnet level.
    • CIncorrect. It is the other way around: security groups support allow rules only, while network ACLs support both allow and deny rules.
    • DIncorrect. Only network ACLs evaluate rules in ascending number order until one matches. Security groups evaluate all their rules before deciding whether to allow traffic.

Where this comes up on the exams

CLF-C02 asks for the difference in a single line. SAA-C03 builds secure-architecture scenarios on it, such as blocking an attacker during an incident. SOA-C03 turns it into troubleshooting with flow logs and Reachability Analyzer.

Related: SQS vs SNS vs EventBridge and EBS vs EFS vs S3, two other pairs AWS exams like to blur.

Sources

Facts checked against the Amazon VPC User Guide on November 14, 2026.

Frequently asked questions

What is the main difference between a security group and a network ACL?

A security group is stateful, applies to instances and has only allow rules. A network ACL is stateless, applies to a whole subnet, has allow and deny rules, and evaluates them in number order until one matches.

Can a security group deny traffic?

No. Security group rules can only allow traffic; anything not allowed is dropped. To explicitly deny an IP address, use a network ACL deny rule with a lower number than any allow rule that would match.

Why do network ACLs need ephemeral port rules?

Network ACLs are stateless, so responses are not allowed automatically. A reply goes to the client's ephemeral port, so the NACL needs a rule allowing that port range in the response direction.

Does a new custom network ACL allow traffic?

No. A custom network ACL denies all inbound and outbound traffic until you add rules. The default network ACL that comes with a VPC allows all traffic.