Security group vs network ACL: compare them.
BeginnerConceptVPC and Networking
Answer
| Security group | Network ACL | |
|---|---|---|
| Level | ENI / instance | Subnet |
| State | Stateful | Stateless |
| Rules | Allow only | Allow and Deny, numbered |
| Evaluation | All rules together | Lowest number first |
| Default | Deny in, allow out | Default NACL allows all |
Security groups are the primary control; NACLs are a coarse backstop, for example to block a bad CIDR subnet-wide.
More on VPC and Networking
What is a VPC and what are the CIDR constraints?BeginnerWhat makes a subnet public or private?BeginnerHow do route tables work, including the local route and longest-prefix match?IntermediateInternet Gateway vs NAT Gateway: what does each do?BeginnerNAT Gateway vs NAT instance?IntermediateWhat are the nuances of security group statefulness?Advanced