Security group versus NACL: explain the differences.
BeginnerScenarioSecurity: Firewalls, SGs, NACLs & VPN
Answer
Situation read → One of the most common interview questions; the key is stateful versus stateless.
What I'd do →
- Security groups attach to ENIs, are stateful, support only allow rules and evaluate all rules together
- NACLs attach to subnets, are stateless, support allow and deny, and evaluate rules in number order
- With a NACL you must allow return traffic yourself, including ephemeral ports 1024-65535
- Use SGs for normal access control and NACLs as a coarse subnet-level backstop or to block a bad IP
- Inspect with
aws ec2 describe-network-acls
Why → Statefulness means SG return traffic is automatic, while a NACL treats each packet independently.
Interview tip → Say NACLs are rarely the first tool; you use them for explicit denies.
More on Security: Firewalls, SGs, NACLs & VPN
How do you let only your office IP SSH into a server?BeginnerWhat does it mean that a security group can reference another security group?BeginnerStateful versus stateless firewalls: what is the practical difference?BeginnerWhat is a WAF and where do you place it?BeginnerWhat is the difference between a site-to-site VPN and a client VPN?BeginnerHow does DNAT or port forwarding work on a Linux gateway?Beginner