Controlling Network Flows in Depth
This lesson explains the network controls that allow only the flows an application needs, between tiers, between VPCs and to the outside, and the distinct role each plays.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the role of each network control.
- Reference security groups rather than CIDR ranges between tiers.
- Explain how Firewall Manager governs flows across accounts.
The controls and their roles
Network traffic is controlled at several layers, each with a distinct role. Security groups attach to instances and network interfaces. They are stateful, have allow rules only, and can reference other security groups, which is how tiers are connected, for example allowing the database group to accept traffic only from the application group. Network ACLs apply to subnets. They are stateless and have allow and deny rules, so they suit explicit denials of address ranges and coarse boundaries between subnets.
AWS Network Firewall inspects traffic at the VPC or transit level, with stateful and stateless rules and intrusion prevention. It provides domain-based egress filtering and TLS inspection. Route 53 Resolver DNS Firewall blocks lookups of malicious or unapproved domains. VPC Lattice auth policies authorise each request between services at the application layer, based on the caller's identity. The following table summarises the controls.
| Control | Layer and state | Use |
|---|---|---|
| Security groups | Instance or interface; stateful; allow rules only | Rules between tiers by referencing other security groups |
| Network ACLs | Subnet; stateless; allow and deny rules | Explicit denies of address ranges and coarse subnet boundaries |
| AWS Network Firewall | VPC or transit; stateful and stateless; IPS | Domain-based egress filtering, intrusion prevention, TLS inspection |
| Route 53 Resolver DNS Firewall | DNS | Blocking lookups of malicious or unapproved domains |
| VPC Lattice auth policies | Application (layer 7) | Per-request authorisation between services |
Security group practices
Security groups stay accurate as the environment changes when rules reference other security groups rather than CIDR ranges between tiers: the database group allows the database port from the application group, so any instance that joins the application tier is allowed automatically and any that leaves it is not. Ranges that appear in many rules, such as on-premises networks or partner addresses, are kept in managed prefix lists, so a change is made once.
Inbound rules open to 0.0.0.0/0 belong only on internet-facing load balancers, never on instances or databases. Because security groups can only allow, blocking a particular address range requires a network ACL deny rule or a firewall.
Governing flows across accounts
Across hundreds of accounts, network rules drift unless they are governed centrally. Firewall Manager security group policies apply common security groups to resources, audit rules for overly permissive access, such as SSH open to the internet, and remove unused or redundant groups, in every account including new ones.
Network Access Analyzer verifies the network against stated intent, for example that no path leads from the internet to any database subnet, and reports every path that violates it. VPC Flow Logs provide evidence of the flows that actually occur, which shows whether rules are wider than the traffic they carry.
Three-tier flows with referenced security groups
A three-tier application must allow only the flows the tiers need, and the rules must keep working as Auto Scaling adds and removes instances. Each tier's security group references the tier in front of it rather than IP ranges:
Security group Inbound rule Source
--------------- --------------------------------------------- --------------------------------------
sg-alb TCP 443 CloudFront origin-facing prefix list
sg-app TCP 8080 sg-alb
sg-db TCP 5432 sg-app
sg-db (no other inbound rules)A new application instance is reachable from the load balancer and can reach the database as soon as it launches, without any rule change. A network ACL on the database subnets adds an explicit deny for a range that an incident response team has flagged, which security groups cannot express. Across the organisation, a Firewall Manager audit policy reports any security group that allows inbound traffic from 0.0.0.0/0 on ports other than 80 and 443, and Network Access Analyzer confirms that no path leads from an internet gateway to the database subnets.
How can overly permissive security group rules be found and fixed across an organisation?
Show answer
With Firewall Manager security group policies, which audit rules across accounts and can remediate them automatically.
Exam Tips
Remember for the exam
- Security groups are stateful and allow only; network ACLs are stateless and can deny.
- Reference security groups between tiers instead of IP ranges.
- To allow egress only to approved domains, use Network Firewall domain lists.
- To audit overly permissive security groups across the organisation, use Firewall Manager.
- To prove that no unintended network paths exist, use Network Access Analyzer.