Service comparisons / Security groups vs Network ACLs

Security groups vs network ACLs

Security groups are stateful allow-only firewalls on each network interface; network ACLs are stateless subnet-level rules that can also deny. How they differ and which one a question needs.

Last checked against AWS documentation · How we write our content

QuestionSecurity groupsNetwork ACLs
Applies toEach network interface (EC2, RDS, Lambda in a VPC, load balancers)Every resource in the subnet
StateStateful; return traffic is allowed automaticallyStateless; return traffic needs its own rule
RulesAllow rules onlyAllow and deny rules
EvaluationAll rules together; traffic is allowed if any rule allows itIn number order; the first matching rule wins
DefaultsNew groups allow all outbound and no inboundThe default ACL allows everything; a new custom ACL denies everything
Best forLeast-privilege access between tiers, by referencing other security groupsBlocking specific IP ranges, and a coarse second layer

Both filter traffic in a VPC, and well-designed networks use both. Exam questions test the differences: where each applies, whether it remembers connections, and whether it can deny.

How to choose

Exam traps