Interview Prep/DevSecOps/Cloud Security, CIS and Compliance

Security groups vs NACLs: what is the difference?

BeginnerConceptCloud Security, CIS and Compliance
Answer

Security groups attach to ENIs, are stateful (return traffic is allowed automatically), and only support allow rules. They can reference other security groups, which is how we express "app tier can reach DB tier on 5432". NACLs attach to subnets, are stateless (you must allow ephemeral return ports), support allow and deny, and are evaluated in rule-number order.

In production security groups do most of the work; NACLs are a coarse backstop, e.g. blocking a known-bad CIDR across a subnet.

All DevSecOps questions Roadmap: Policy as code

More on Cloud Security, CIS and Compliance