Network ACL
- Applied to a subnet in a VPC
- Gets evaluated before traffic reaches an EC2 Network interface
- Applies to all resources in a subnet
- Rules are numbered and applied from lowest and highest
- Can have both allow and deny rules
- Stateless ?- inbound traffic does not automatically allow outbound traffic
Example:
- Allow inbound TCP 80 from 0.0.0.0/0
- Deny inbound from a specific IP range
Security Group
- Stateful - if you allow inbound, the response traffic is automatically allowed out (and vice versa)
- Applied at Instance level
- Tied to resources (EC2, ENI, RDS, Lambda in VPC, etc.)
- No explicit deny rules, if not allowed than by default it is denied
- Rules are evaluated as a whole (no order/priority).
Example:
- Allow inbound TCP 443 from 0.0.0.0/0
- Allow inbound TCP 22 from corporate IP