Skip to Content
Asterrr's Handbook
3 · Infrastructure security

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.

DNS queryfilterWorkloadVPC ResolverDNS FirewallQuery loggingCloudWatch LogsS3Firehose
Queries from a VPC pass through the Resolver. DNS Firewall rules can block them, and query logs go to one of three destinations.

Query logging

ItemWhat to remember
CoversQueries from VPCs you associate, from on-premises through an inbound endpoint, through an outbound endpoint, and DNS Firewall rule actions
FieldsVPC ID, source IP and instance ID, time, DNS name, record type, response code, response data, firewall action
DestinationsCloudWatch Logs, S3 or Firehose
CachingOnly unique queries are logged. A repeat answered from the resolver cache within its TTL is not logged
AssociationYou 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

ItemWhat to remember
ModelReusable rule groups of domain list rules, associated with VPCs
ActionsAllow, alert, or block
StrategiesDeny known-bad domains and allow the rest, or allow only trusted domains and deny the rest
Protects againstDNS exfiltration from a compromised instance, and lookups of private hosted zone names, VPC endpoint names and EC2 instance names you want hidden
SetupPart of the VPC Resolver, no extra resolver setup
Multi-accountFirewall 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 FirewallNetwork Firewall
SeesOutbound DNS queries to the VPC ResolverNetwork and application traffic
Blind toConnections made by IP addressQueries 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.

Further reading

On this page