Subchapter 91.6
references/identifying-the-effective-dns-firewall-rule.mdMarkdown15 KBView on GitHub
Domain expertise for working out which single Route 53 Resolver DNS Firewall rule decides the outcome for a domain when a VPC has several rule groups associated and more than one rule could match. Covers the two-layer evaluation order (rule group association priority, then rule priority within a group), the first-match-wins behavior that makes a high-priority Allow or Alert shadow a lower-priority Block, and how to read the live configuration to name the winning rule.
This is a read and diagnostic workflow. It inspects configuration and explains the result; it does not create or change rules. For authoring blocking rules see the blocking-malicious-domains reference, and for fanning rule groups across accounts see the centralizing-dns-firewall reference.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise.
To identify the effective rule for a domain, follow the procedure exactly. See the Procedure section below.
The procedure covers:
DNS Firewall evaluates in a fixed order and stops at the first match:
NODATA, NXDOMAIN, or
OVERRIDE), log the block, stop inspecting.Because every action halts inspection, a broad Allow or Alert in a higher-priority group prevents a Block in a lower-priority group from ever running for that domain. That shadowing is the usual reason a domain the customer expected to be blocked is not.
Constraints:
*. wildcard.
Wildcard semantics: the * can only appear as the leftmost label; *.example.com matches any
subdomain (e.g., sub.example.com, deep.sub.example.com) but does NOT match the apex
example.com itself. Check the query name and each parent label, not just an exact stringFirewallDomainRedirectionAction
setting determines whether CNAME/DNAME chain targets are also inspected against firewall rules
(INSPECT_REDIRECTION_DOMAIN) or trusted without further inspection
(TRUST_REDIRECTION_DOMAIN). When a query follows a CNAME chain, this setting affects which
domains in the chain are evaluated against rules| Situation | What applies |
|---|---|
| Domain matches one rule only | That rule’s action applies |
| Domain matches rules in several groups | The match in the lowest-association-priority group wins; lower groups are not consulted |
| Domain matches several rules in one group | The lowest-rule-priority match in that group wins |
| A high-priority Allow or Alert matches the domain | It wins and halts inspection; any lower Block is shadowed and never runs |
A higher-priority Allow or Alert rule matches the domain first and halts inspection. Find the first matching rule in evaluation order; the Block sits below it and never runs.
A newly associated group took a lower (higher-priority) association number, or a Profile-managed group was added, changing which group is evaluated first. Re-sort the associations by priority.
Each association on a VPC must have a unique priority. If a tool reports a clash, an association was just changed; re-read the associations before concluding.
The domain is in an AWS-managed domain list referenced by a rule. Check managed-list rules, not just custom lists.
The rule has a Qtype filter (e.g., A only) that does not match the query type (e.g., the query is AAAA or MX). Check the rule’s Qtype setting; if it is set, only queries of that type trigger it.
This procedure determines which DNS Firewall rule decides the outcome for a domain on a VPC that has one or more rule groups associated. It reads the rule group associations and their priorities, reads the rules and their priorities within each candidate group, finds the first match in evaluation order, and reports the effective rule and what it shadows. It changes nothing.
vpc-0abc123).us-east-1).example.com).Constraints for parameter acquisition:
Constraints:
aws sts get-caller-identityaws sts assume-role) rather than long-lived IAM user access keys.Constraints:
You MUST list the associations for the VPC and order them by Priority, lowest first:
aws route53resolver list-firewall-rule-group-associations \
--vpc-id {vpc_id} --region {region}The lowest Priority association is evaluated first. Note each association’s
FirewallRuleGroupId in that order
A VPC can have one Route 53 Profile, and rule groups applied through that Profile may not appear
in list-firewall-rule-group-associations. You MUST also check for a Profile on the VPC and
enumerate its rule group resource associations, folding them into the same priority-ordered walk
as the directly associated rule groups:
aws route53profiles list-profile-associations --resource-id {vpc_id} --region {region}
aws route53profiles list-profile-resource-associations \
--profile-id {profile_id} --region {region}Constraints:
For each associated rule group, in association-priority order, you MUST list its rules ordered
by rule Priority, lowest first:
aws route53resolver list-firewall-rules \
--firewall-rule-group-id {rule_group_id} --region {region}For a rule that references a FirewallDomainListId, resolve whether {domain} (or a parent the
list matches via a *. wildcard) is in that list. Custom lists can be enumerated:
aws route53resolver list-firewall-domains \
--firewall-domain-list-id {domain_list_id} --region {region}AWS-managed domain lists CANNOT be enumerated or downloaded; list-firewall-domains does not
return their contents. For a rule backed by a managed list, determine a match from Resolver
query logs (see Step 3a) or by testing an AWS-provided test domain, not by listing the list
Advanced rule types (DGA, DNS tunneling) have no FirewallDomainListId; they match by
detection. Treat such a rule as a potential match by its rule type and confirm from query logs
When Resolver query logging is enabled on the VPC, the logs name the rule that acted on a query and are the authoritative way to confirm the effective rule, especially for managed-list and Advanced rules whose contents you cannot enumerate.
Constraints:
firewall_rule_group_id,
firewall_rule_action, and the matched firewall_domain_list_id for the queryALERT and BLOCK actions
but NOT for ALLOW. A query permitted by a shadowing Allow rule will not name that rule in the
logs, so a domain that resolves with no firewall fields may still have matched an Allow. Fall
back to the configuration walk (Step 4) to find a shadowing AllowConstraints:
{domain} AND the query type — by exact name,
by a parent wildcard in its domain list, or by detection for an Advanced rule. A rule with a
Qtype filter that does not match the query’s type is skipped even if the domain matchesALLOW, ALERT, or BLOCK
plus the block response mode), and explain that the match halts inspection{domain} and note they are shadowed and
never apply, so the customer sees why a Block below an Allow or Alert has no effectConstraints:
You MUST present the rule group detail view for the winning rule’s group, filling {region}
with the VPC’s Region and {ruleGroupId} with the matched rule group’s ID. The fragment is
RulegroupId (lowercase g):
https://{region}.console.aws.amazon.com/vpcconsole/home?region={region}#DNSFirewallRuleGroupDetails:RulegroupId={ruleGroupId}If no rule matches {domain} in any associated group, you MUST say so plainly: DNS Firewall
takes no action and the query resolves normally
You SHOULD note that this “resolves normally” outcome assumes the firewall is healthy. If the firewall cannot be reached, the VPC’s DNS Firewall fail-open setting decides the result; the default is fail-closed (the query is blocked), unless fail-open is enabled
{
"vpc_id": "vpc-0abc123",
"region": "us-east-1",
"domain": "ads.example.com"
}Effective rule for ads.example.com on vpc-0abc123:
- Rule group "corp-allowlist" (association priority 100), rule "allow-partners" (rule priority 10)
ACTION: ALLOW — matches ads.example.com, halts inspection.
Shadowed (never reached):
- Rule group "threat-block" (association priority 200), rule "block-adtech" (rule priority 10)
would BLOCK/NXDOMAIN, but the ALLOW above wins.
Verify in the console:
https://us-east-1.console.aws.amazon.com/vpcconsole/home?region=us-east-1#DNSFirewallRuleGroupDetails:RulegroupId=rslvr-frg-0123456789abcdef0A higher-priority Allow or Alert matched first and halted inspection (Step 4). The Block sits in a lower-priority position and never runs.
A new association took a higher-priority (lower-numbered) slot, or a Profile-managed group was added. Re-sort the associations (Step 2).
The domain is in an AWS-managed domain list, not a custom one. Resolve managed lists too (Step 3).
aws sts assume-role) rather than
long-lived IAM user access keys. This workflow only reads, so read-only credentials suffice.