Blocking Malicious Domains with Route 53 Resolver DNS Firewall
This lesson explains how Route 53 Resolver DNS Firewall filters the DNS queries that leave every VPC, stopping a compromised workload from reaching its controller before any connection is made.
Learning outcomes
After completing this lesson, you will be able to:
- Configure DNS Firewall rules and actions, including AWS managed domain lists.
- Describe how DNS Firewall is deployed across many accounts.
- Explain how bypasses that send DNS queries to other resolvers are closed.
Rules and actions
Security groups and network ACLs filter traffic by IP address, but malware often uses domain names whose addresses change constantly. Route 53 Resolver DNS Firewall filters at the DNS level instead: it inspects the queries that resources in a VPC send to the Route 53 Resolver and can refuse to resolve domains associated with malware or command-and-control servers, so the connection never starts. Rules are grouped in rule groups that are associated with VPCs and can be deployed across accounts with AWS Firewall Manager. The following list describes its capabilities.
- Filters outbound DNS using AWS managed domain lists (malware, botnet command and control, aggregated threats) or your own lists.
- Actions: block (NXDOMAIN, NODATA or a custom response), alert or allow.
- DNS Firewall Advanced rules detect DNS tunnelling and domain generation algorithm (DGA) patterns.
The following diagram shows a DNS Firewall rule group and how Firewall Manager applies it to every VPC.

DNS Firewall rules
Deploying at scale
DNS Firewall protects only the VPCs its rule groups are associated with, so a single unprotected VPC leaves a gap. Three mechanisms provide coverage across many accounts. A Firewall Manager DNS Firewall policy associates rule groups with every VPC in the organisation, or in chosen accounts, and applies them automatically to new VPCs, which makes it the strongest option for consistent coverage. AWS RAM shares rule groups with chosen accounts, which then associate them themselves. Route 53 Profiles bundle DNS Firewall associations with other DNS settings, such as private hosted zones and Resolver rules, and apply them to many VPCs together. The following table summarises the options.
| Option | Effect |
|---|---|
| Firewall Manager DNS Firewall policy | Associates rule groups with every VPC in the organisation, including new ones |
| AWS RAM sharing | Shares rule groups with chosen accounts |
| Route 53 Profiles | Applies DNS Firewall associations with other DNS settings to many VPCs |
DNS Firewall at scale
Closing bypasses
DNS Firewall sees only queries sent to the Route 53 Resolver. Security groups, network ACLs or Network Firewall should block outbound DNS to other resolvers, and the VPC's fail mode decides whether queries are blocked or allowed when the firewall cannot evaluate them.
Closing the bypasses
Blocking malicious domains with DNS Firewall
The security team wants every VPC to refuse to resolve domains on AWS's malware and botnet lists, and to alert (but not block) on a custom list while it is being tuned:
RG_ID=$(aws route53resolver create-firewall-rule-group --name org-dns-protection \
--creator-request-id rg-$(date +%s) --query FirewallRuleGroup.Id --output text)
aws route53resolver create-firewall-rule --firewall-rule-group-id $RG_ID --name block-aws-malware \
--priority 100 --action BLOCK --block-response NXDOMAIN \
--firewall-domain-list-id $AWS_MANAGED_MALWARE_LIST_ID --creator-request-id r1-$(date +%s)
aws route53resolver create-firewall-rule --firewall-rule-group-id $RG_ID --name alert-custom \
--priority 200 --action ALERT \
--firewall-domain-list-id $CUSTOM_LIST_ID --creator-request-id r2-$(date +%s)A Firewall Manager DNS Firewall policy associates the rule group with every VPC in the organisation, including future ones. Alerts and blocks appear in Resolver query logs with the rule that matched, so the custom list can be promoted from ALERT to BLOCK once it causes no false positives.
Which feature detects DNS tunnelling?
Show answer
DNS Firewall Advanced.
Exam Tips
Remember for the exam
- To stop instances resolving malicious domains, use Resolver DNS Firewall.
- To deploy DNS Firewall rules across the organisation, use Firewall Manager.
- To detect DNS tunnelling, use DNS Firewall Advanced.
- Use ALERT to trial a domain list before BLOCK.
- Block outbound DNS to other resolvers, or workloads can bypass DNS Firewall.