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.
Exam tasks: 3.3 (network controls that permit or prevent traffic; north/south and east/west protection)
The decision: is the traffic you must stop a DNS lookup or an actual connection?
Every VPC resolves names through the Route 53 Resolver. Query logging records those lookups for investigation. DNS Firewall filters the outbound ones with domain lists, which is the main defense against DNS-based data exfiltration.
Query logging
| Item | What to remember |
|---|---|
| Covers | Queries from VPCs you associate, from on-premises through an inbound endpoint, through an outbound endpoint, and DNS Firewall rule actions |
| Fields | VPC ID, source IP and instance ID, time, DNS name, record type, response code, response data, firewall action |
| Destinations | CloudWatch Logs, S3 or Firehose |
| Caching | Only unique queries are logged. A repeat answered from the resolver cache within its TTL is not logged |
| Association | You associate a query logging configuration with each VPC to log |
Typical use is spotting lookups to known malicious domains, tracing a compromised instance, and feeding a SIEM.
Exam trap
Only queries that use the VPC resolver are captured. Instances configured with another DNS server, or clients using DNS over HTTPS or TLS, bypass these logs. GuardDuty DNS findings share the same blind spot.
DNS Firewall
| Item | What to remember |
|---|---|
| Model | Reusable rule groups of domain list rules, associated with VPCs |
| Actions | Allow, alert, or block |
| Strategies | Deny known-bad domains and allow the rest, or allow only trusted domains and deny the rest |
| Protects against | DNS exfiltration from a compromised instance, and lookups of private hosted zone names, VPC endpoint names and EC2 instance names you want hidden |
| Setup | Part of the VPC Resolver, no extra resolver setup |
| Multi-account | Firewall Manager DNS Firewall policy attaches rule groups to VPCs automatically |
More on DNS Firewall rules
- Domain lists can be your own or AWS managed (malware, botnet C2, aggregate threats).
- Block responses can be NODATA, NXDOMAIN or an OVERRIDE answer.
- DNS Firewall Advanced rules detect DNS tunneling and domain generation algorithm (DGA) patterns rather than fixed names.
- Choose fail open (keep resolving if DNS Firewall is impaired) or fail closed per VPC.
- It can't see queries sent straight to an outside resolver like 8.8.8.8. Block outbound 53 and 853 in security groups, NACLs or Network Firewall so everything goes through the VPC Resolver.
- The Route 53 Resolver is now called the Route 53 VPC Resolver.
DNS Firewall versus Network Firewall
| DNS Firewall | Network Firewall | |
|---|---|---|
| Sees | Outbound DNS queries to the VPC Resolver | Network and application traffic |
| Blind to | Connections made by IP address | Queries made to the VPC Resolver |
Exam signal
"Stop data leaving through DNS lookups" or "block resolution of a bad domain for every VPC": DNS Firewall, deployed with Firewall Manager. A network ACL cannot do this because DNS to the resolver is exempt.
Exam signal
"Allow outbound connections only to approved domains": Network Firewall domain list (or a proxy) filters the connection. "Stop malware resolving command-and-control domains" or "detect DNS tunneling": DNS Firewall. Many answers use both, because each sees a different path.