How Security Groups Filter Traffic
Understand the stateful firewall attached to each resource.
The Resource Firewall
A security group (SG) is a virtual firewall that attaches directly to an elastic network interface (ENI) on a resource such as an EC2 instance, an RDS database, or a load balancer. It controls inbound and outbound traffic at the resource level rather than at the network boundary, so two instances in the same subnet can have very different rules.
Allow-Only Rules
Security groups contain allow rules only. There is no way to write an explicit deny. Any traffic that does not match an allow rule is simply dropped. This means you build access by adding the permits you want, and the implicit default is to block everything else.
All lessons in this course
- How Security Groups Filter Traffic
- How Network ACLs Filter Subnets
- Stateful versus Stateless Behavior
- Layering Both for Defense in Depth