Filtering Traffic and DNS with Network Firewall and DNS Firewall
This lesson explains how AWS Network Firewall inspects traffic inside and between VPCs and how Route 53 Resolver DNS Firewall filters DNS queries, and why both must be routed or associated correctly to work.
Learning outcomes
After completing this lesson, you will be able to:
- Describe Network Firewall deployment and rule groups.
- Configure DNS Firewall rule groups and domain lists.
- Audit both services in a single account.
AWS Network Firewall
AWS Network Firewall is a managed, stateful network firewall and intrusion prevention service. A firewall is deployed into dedicated firewall subnets, one per AZ, creating firewall endpoints. A firewall policy contains stateless rule groups (5-tuple rules evaluated first, with pass, drop or forward to stateful actions) and stateful rule groups (domain list rules to allow or deny by HTTP host or TLS SNI, standard 5-tuple rules, and Suricata-compatible IPS rules), plus AWS managed threat signature groups. TLS inspection can decrypt traffic with certificates from ACM.
Traffic is inspected only if routing sends it through the firewall endpoints. For internet egress, the private subnets route 0.0.0.0/0 to the firewall endpoint in their AZ, the firewall subnet routes to the NAT gateway or internet gateway, and for inbound inspection an IGW ingress route table sends traffic for the public subnets back through the firewall. Asymmetric routing, where return traffic bypasses the firewall or uses another AZ's endpoint, breaks stateful inspection. Alert, flow and TLS logs go to CloudWatch Logs, S3 or Firehose, and CloudWatch metrics show packets passed and dropped.
The following diagram compares routing that bypasses the firewall with routing through it.

A firewall that sees nothing
Route 53 Resolver DNS Firewall
DNS Firewall filters outbound DNS queries that VPC resources send to the Route 53 Resolver. Rule groups contain rules that reference domain lists, either your own or AWS managed lists of malware, botnet command-and-control and other threat domains, with actions ALLOW, BLOCK (with NODATA, NXDOMAIN or an override response) or ALERT (log only). Rule groups are associated with VPCs in priority order and can be shared with AWS RAM. The VPC's fail mode decides whether queries are allowed (fail open) or blocked (fail closed) if DNS Firewall cannot respond. Blocked and alerted queries appear in Resolver query logs. DNS Firewall only sees queries sent to the Route 53 Resolver; instances configured to use other DNS servers bypass it, which Network Firewall rules can prevent.
| Requirement | Service |
|---|---|
| Block HTTP/SQL injection and rate-limit web requests | AWS WAF |
| Protect against large DDoS attacks with expert support | AWS Shield Advanced |
| Filter outbound traffic by domain, IPS signatures, stateful rules in the VPC | AWS Network Firewall |
| Block DNS lookups of malicious domains from VPC resources | Route 53 Resolver DNS Firewall |
| Instance-level allow rules | Security groups |
| Subnet-level deny of IP ranges | Network ACLs |
Network Firewall or DNS Firewall?
Auditing in a single account
The exam guide asks for auditing these services in a single account. For Network Firewall, confirm that every subnet's route table sends the intended traffic through the endpoint in the same AZ, that the policy contains the expected rule groups with drop actions (not only alerts), that logging is enabled, and that metrics show traffic being inspected. For DNS Firewall, confirm that rule groups are associated with every VPC, that block rules are not in ALERT mode, that the fail mode matches policy, and that Resolver query logging is enabled. Reachability Analyzer can confirm whether a path passes through a firewall endpoint.
A firewall that inspects nothing
A Network Firewall deployment shows zero packets in its metrics, although applications reach the internet. The private subnets' route tables still send 0.0.0.0/0 directly to the NAT gateways; the firewall endpoints were created but never inserted into the path. The engineer changes the private route tables to point 0.0.0.0/0 to the firewall endpoint in the same AZ and gives each firewall subnet a route table that sends 0.0.0.0/0 to the NAT gateway in its AZ, keeping traffic symmetric. Flow logs from the firewall then show the expected traffic and the domain deny list starts dropping requests.
Which service blocks queries for malicious domains through the Route 53 Resolver?
Show answer
Route 53 Resolver DNS Firewall.
Exam Tips
Remember for the exam
- Network Firewall inspects only traffic routed through its endpoints; keep routing symmetric per AZ.
- Stateful rule groups filter by domain (HTTP host, TLS SNI) and Suricata IPS rules.
- DNS Firewall blocks or alerts on domains queried through the Route 53 Resolver.
- ALERT mode logs only; check actions when auditing.
- Choose WAF for web layer, Shield for DDoS, Network Firewall for VPC traffic, DNS Firewall for DNS.