Egress Filtering and Domain Allow Lists
Restrict outbound traffic to approved domains with Network Firewall, Route 53 Resolver DNS Firewall, or a self-managed proxy.
Exam tasks: 3.3 (network controls that permit or prevent traffic; north/south and east/west protection)
The decision: must outbound traffic reach only approved destinations, and at which layer do you enforce that?
Security groups and NACLs filter by IP and port, never by domain name. To let workloads reach only approved sites, filter at the DNS layer, at an inline network firewall, or at a proxy. An allow list denies everything by default, which is stricter than a block list.
Options compared
| Option | Layer | Strength | Limit |
|---|---|---|---|
| Route 53 Resolver DNS Firewall | DNS | Allow, block or alert on domain lists. Managed domain lists. Advanced rules for DGA and DNS tunneling. Applies to VPC and on-premises queries that come through the VPC resolver | Filters DNS names only. Does not filter HTTPS, SSH or other protocols. A client that hard-codes an IP or uses another resolver is not covered |
| AWS Network Firewall | L3 to L7 | Stateless and stateful rules, Suricata-compatible IPS rules, domain filtering, deep packet inspection, protocol detection regardless of port | Needs dedicated firewall subnets and route table changes. Endpoint cannot inspect its own subnet |
| Self-managed proxy (Squid, Varnish) | HTTP/HTTPS | Domain allow list and content filtering | You run and patch the EC2 instance |
| Security group or NACL | L3/L4 | Cheap and fast | No domain awareness |
Egress patterns by effort
| Pattern | What it gives you | Effort |
|---|---|---|
| No route to the internet (isolated subnets + VPC endpoints) | Strongest. Nothing leaves except to AWS services | Low, if workloads only need AWS APIs |
| NAT gateway alone | Hides private IPs. Filters nothing | Low |
| Network Firewall (central egress VPC) with domain lists | FQDN allow list, IPS signatures, logs | Medium |
| Explicit forward proxy fleet (for example Squid) behind an NLB | URL-level allow list, user auth, caching | High, because you patch and scale it |
| GWLB + vendor firewall | Vendor URL categories and threat feeds | High |
- An explicit proxy only filters clients configured to use it. Pair it with security groups or NACLs that stop direct outbound 80/443, or clients just go around it.
- Use VPC endpoints with endpoint policies so traffic to AWS services never reaches the egress path. See VPC network controls.
DNS Firewall behavior
- Rule groups attach to a VPC. Rules and rule groups are processed from the lowest priority number up, and evaluation stops at the first match.
- Rule actions are allow (domain lists only), block and alert. Blocked queries can get a custom response.
- If DNS Firewall cannot answer, the resolver fails closed and blocks the query by default. The VPC fail mode is configurable.
- It is regional. A rule group can be shared with other accounts, and Firewall Manager can manage DNS Firewall policies across an organization.
Network Firewall behavior
- You create a firewall, a firewall policy and rule groups. Endpoints live in a firewall subnet in each Availability Zone.
- Route tables steer traffic through the endpoint, typically between the internet gateway or NAT gateway and the protected subnets.
- A firewall policy can reference stateless and stateful rule groups.
- TLS inspection uses an ACM certificate to decrypt and re-encrypt traffic.
- Firewall Manager manages firewalls across an organization.
Self-managed proxy pattern
- Run Squid or Varnish on an EC2 instance in a public subnet.
- Allow inbound ports 80 and 443 from the private subnet.
- Point the private subnet's route to the proxy instance for internet traffic.
- Disable the source/destination check on the proxy ENI because it forwards traffic not addressed to itself.
Exam signal
"Allow outbound HTTPS only to a list of vendor domains" means Network Firewall with a domain list rule. "Block malware command and control domains for all VPCs" means DNS Firewall with a managed domain list.
Exam trap
DNS Firewall only sees queries sent through the Route 53 VPC resolver. Traffic to a raw IP address bypasses it, and so does DNS to a third-party resolver. Pair it with Network Firewall or a deny-by-default egress route.
Scenarios
A domain list on Network Firewall filters the TLS connections by SNI, and strict order with a default drop blocks and logs everything else. Package CDNs change IP addresses often, so IP-based security group rules break. DNS Firewall alone stops name lookups but not connections to hard-coded IPs. NAT gateways have no filtering feature.
Related
Further reading
Route 53 Resolver Query Logs and DNS Firewall
DNS visibility and filtering at the VPC resolver. What is logged, where it goes, and how DNS Firewall stops exfiltration.
Network segmentation
North/south and east/west traffic, public, private and isolated subnet tiers, and Transit Gateway route tables that keep environments apart.