AWS Cloud Firewalls: Network Firewall, DNS Firewall, Firewall Manager and WAF
You know firewall types and Linux host locks. On AWS the palette is wider: Security Groups, NACLs, AWS Network Firewall, Route 53 Resolver DNS Firewall, Firewall Manager, and WAF. Mumbai fintech Arjun Mehta and Toronto bank SRE Emily Chen wire an inspection VPC once, then reuse it. This chapter stays brief on SG vs NACL (full class: SG vs NACL) and links WAF/Shield deep chapters instead of rewriting them.
What you'll learn in this chapter
- Place SG, NACL, Network Firewall, DNS Firewall, FMS and WAF on one diagram
- Explain Network Firewall stateless vs stateful and Suricata rules
- Describe the inspection VPC pattern
- Use DNS Firewall and Firewall Manager at org scale
- Run a small hands-on lab and know where WAF fits
1. Everyday example
Emily's bank has three doors: the street gate (edge WAF + Shield on CloudFront), the building lobby metal detector (AWS Network Firewall in an inspection VPC), apartment locks (Security Groups + host FW), and a "do not dial these phone numbers" list (DNS Firewall). Firewall Manager is the corporate policy that says every branch must install the same lobby detector.
2. Map of AWS firewall-ish controls
| Control | Layer / scope | Deep chapter |
|---|---|---|
| Security Group | Stateful ENI L3/L4 | SG vs NACL |
| NACL | Stateless subnet L3/L4 | Same class chapter |
| AWS Network Firewall | VPC L3–L7 Suricata | This chapter |
| DNS Firewall | Resolver query filter | This chapter |
| AWS WAF | HTTP/S Web ACL | WAF explained |
| AWS Shield | DDoS L3/4/7 | Shield |
| Firewall Manager | Org policy for WAF/NF/DNS/SG | This chapter + DDoS project |
3. SG vs NACL — brief only
What is it?
Security Groups are stateful and attach to ENIs. NACLs are stateless and attach to subnets. Allow/deny behaviour, rule numbers, and the 3-tier lab live entirely in Security Group vs NACL. Here we only say: design SG first for instance policy; use NACL sparingly for subnet guardrails.
4. AWS Network Firewall
Why do we need this?
You need central inspection for traffic that SG alone cannot express well: domain allow-lists on HTTPS (via Suricata), east-west controls between VPCs, explicit deny lists with alert logs, IPS-style signatures.
Stateless rule groups
Like a fast packet filter: 5-tuple (src/dest IP, port, protocol) with pass/drop/forward. Evaluated first. Use for coarse "drop this bogon range" before stateful engines spend CPU.
Stateful rule groups
Suricata-compatible rules and domain lists. Actions include alert, drop, pass. Example domain allow-list for egress: only *.amazonaws.com and your partner APIs leave the VPC.
# Conceptual Suricata-style rule (managed in Network Firewall rule group)
# drop http $HOME_NET any -> $EXTERNAL_NET any (http.host; content:"evil.example"; sid:1000001; rev:1;)
# Domain list rule group: allow-list mode with .example.com and .amazonaws.com
Inspection VPC pattern
Spoke VPCs send traffic to a central inspection VPC via Transit Gateway. Network Firewall endpoints sit in inspection subnets. Return path must be symmetric or state breaks. This is the pattern Emily uses for 40 app VPCs.
5. Route 53 Resolver DNS Firewall
Filters DNS queries from VPCs through Resolver. Domain lists (AWS managed threat lists or your own) with allow/block/alert actions. Stops malware call-homes even when HTTPS is encrypted — because the name lookup still happens.
- Block known malicious domains org-wide
- Alert on newly seen domains for SOC
- Pair with Network Firewall domain TLS rules for defense in depth
6. AWS Firewall Manager
Organisation-level policy: require a WAF rule group on every CloudFront/ALB, require Network Firewall in every VPC, require DNS Firewall rule groups, or SG audit rules. Prevents one account from "forgetting" CRS. Used in the DDoS-resilient architecture project.
7. Where WAF fits
WAF = Layer-7 HTTP on CloudFront, ALB, API Gateway, AppSync, Cognito. It does not replace Network Firewall for non-HTTP or east-west VPC flows. Deep: WAF explained, WAF hands-on, survey CloudFront+WAF.
8. Multi-industry snapshots
- Bank (Emily, Toronto): inspection VPC + Suricata drop sid list; DNS Firewall AWS managed list; FMS WAF baseline.
- Hospital (Adaeze): Network Firewall deny to gambling/social on clinical VPC egress; WAF on patient portal only.
- D2C (Lucas): CloudFront WAF edge; light Network Firewall on partner VPC peering path.
- SaaS (Vikram, Pune): FMS to force SG SSH≠0.0.0.0/0 across 12 accounts.
9. Lab: Network Firewall + DNS Firewall sketch
Use a dedicated lab account. Budget alert first. Region ap-south-1 unless blocked.
How to do it (step by step)
- Create a small VPC with public + firewall + private subnets (or use Network Firewall getting-started wizard).
- Create Network Firewall with a stateful domain allow-list (your test domain only) for egress from private subnet.
- Route private→firewall endpoint→IGW/NAT carefully; document the route table IDs.
- From a private instance: curl allowed domain (ok) and a random domain (blocked/timeout).
- Create a Resolver DNS Firewall rule group blocking a test domain; associate to VPC.
- nslookup blocked domain → NXDOMAIN/blocked per config; allowed domain resolves.
- Optional: in Firewall Manager (org admin), sketch a policy — do not attach to prod OUs in lab.
# Illustrative CLI fragments (fill IDs)
aws network-firewall create-firewall --firewall-name lab-fw --firewall-policy-arn $POLICY_ARN \
--vpc-id $VPC --subnet-mappings SubnetId=$FW_SUBNET
aws route53resolver create-firewall-rule-group --creator-request-id lab1 --name lab-dns
# associate rule group to VPC with create-firewall-rule-group-association
Cleanup (stop billing)
- Delete firewall endpoints / firewall / policies / rule groups.
- Delete DNS Firewall associations and rule groups.
- Remove lab route table edits; delete lab VPC if dedicated.
- Confirm Cost Explorer: Network Firewall hourly charges gone.
10. Firewall decision checklist
- Write the threat in one sentence (scan, SQLi, malware DNS, lateral SSH).
- Pick the layer: packet / stateful / proxy / NGFW / WAF / DNS / host.
- Pick the form: host tool, network appliance, or cloud service.
- Default deny or default allow? Write it down.
- Plan allow tests and deny tests before go-live.
- Plan logging destination (file, CloudWatch, SIEM).
- Name the on-call for false positives.
- Link the deep chapter you will not duplicate (SG/NACL, WAF, hardening).
- Estimate monthly cost (especially Network Firewall).
- Schedule a reboot or failover test for persistence.
11. Copy-paste quick commands
# --- Host (Ubuntu ufw) ---
sudo ufw status verbose
sudo ufw allow OpenSSH && sudo ufw allow 80/tcp && sudo ufw enable
# --- Host (RHEL firewalld) ---
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload
# --- Host (nft) ---
sudo nft list ruleset
# --- AWS pointers (details in linked chapters) ---
aws ec2 describe-security-groups --group-ids $SG
aws wafv2 list-web-acls --scope REGIONAL --region ap-south-1
aws network-firewall list-firewalls --region ap-south-1
aws route53resolver list-firewall-rule-groups --region ap-south-1
12. More industry stories
- Retail POS (Kenji, Osaka): host FW on till PCs; network FW between stores and HQ; WAF only on ecommerce, not on private VPN APIs.
- Media streaming (Priya, Pune): CloudFront+WAF for viewers; Network Firewall for origin admin VPC; Shield Advanced on match-day.
- Gov portal (Fatima, Rabat): FMS mandates WAF CRS + DNS Firewall across ministries; local teams cannot disable.
- Startup (Diego, São Paulo): start with SG+ufw+CloudFront WAF; add Network Firewall when east-west grows.
- Logistics (Mei, Singapore): DNS Firewall blocks sinkholes; Suricata drops known C2 on inspection VPC.
13. Glossary (short)
| Term | Meaning |
|---|---|
| Netfilter | Linux kernel packet filter framework |
| Suricata | IDS/IPS engine; Network Firewall stateful dialect |
| 5-tuple | src IP, dest IP, proto, src port, dest port |
| East-west | Traffic between workloads inside the cloud/DC |
| North-south | Traffic in/out to internet or partners |
| Default deny | If no rule matches, drop |
| False positive | Legit traffic blocked by mistake |
14. Practice: explain out loud
- 60 seconds: building-guard story for firewall types.
- 60 seconds: iptables vs nftables vs firewalld vs ufw.
- 60 seconds: SG vs NACL vs Network Firewall vs WAF.
- 60 seconds: inspection VPC with Transit Gateway.
- Record yourself once; fix filler words; record again.
15. Safe lab hygiene
- Never practice DROP rules on a production SSH session without console access.
- Tag every cloud lab resource with owner and expiry.
- Keep a written rollback: old ruleset file or SG snapshot.
- Prefer allowlists over giant denylists when starting.
- After lab, delete Network Firewall — it bills hourly.
16. How this set links other chapters
- Networking basics / ports — foundations before filters.
- SG vs NACL class — stateful vs stateless on AWS VPC.
- Linux hardening survey — SELinux, fail2ban, auditd beyond FW.
- CloudFront+WAF survey — CDN/HTTPS + light WAF.
- WAF explained / hands-on / Shield / DDoS project — L7 and DDoS depth.
17. Rule-writing workshop
Write rules in English first, then translate to the tool. Bad: "block bad stuff". Good: "Drop TCP 445 from 0.0.0.0/0 on INPUT; allow TCP 445 only from 10.0.0.0/16".
- Name the direction: inbound, outbound, or east-west.
- Name the 5-tuple or domain or HTTP path.
- Name the action: accept, drop, alert, challenge.
- Name the hit counter / log you will check.
- Name the rollback (previous ruleset file).
- Peer-review with someone who did not write it.
18. Sample allow / deny matrix
| Flow | SG | Host FW | Edge WAF | Network FW |
|---|---|---|---|---|
| Public HTTPS to web | 80/443 from 0.0.0.0/0 | 80/443 | CRS+rate on /login | usually not on edge path |
| SSH to bastion | 22 from corp CIDR | 22 corp only | n/a | optional geo/IP |
| App to DB | 3306 from app SG | optional deny others | n/a | east-west inspect optional |
| Private egress DNS | 53 via resolver | allow | n/a | DNS FW lists + NF domain |
19. Ten oral drill questions
- Say three differences between packet filter and stateful.
- Name four Linux host firewall tools.
- Why does connection refused ≠ filtered?
- What is an inspection VPC for?
- When is UTM a good first buy?
- Where do Suricata rules run on AWS?
- What does Firewall Manager stop?
- Why link SG vs NACL instead of rewriting?
- Give one healthcare and one fintech firewall story.
- What do you delete first in lab cleanup for cost?
20. Common errors and fixes
Each row is a real mistake students and juniors hit. Read the fix before you panic.
| Error / symptom | Fix |
|---|---|
| Asymmetric routes around Network Firewall | State drops — fix return path through FW. |
| Expecting WAF to filter VPC east-west SMB | Use Network Firewall / SG; WAF is HTTP. |
| DNS Firewall without Resolver | Only filters queries via Resolver endpoints/rules. |
| FMS policy on wrong OU | Dry-run / monitor first; exclude lab OUs. |
| Stateless drop without logging | Add alert/pass counters; use stateful alert. |
| Leaving 0.0.0.0/0 SSH SG + no FMS audit | Turn on FMS SG common audit. |
| Duplicating full SG vs NACL lab here | Link the class chapter instead. |
| Forgetting Network Firewall hourly cost | Delete lab FW after proof. |
| Suricata sid conflicts | Reserve private sid ranges; document. |
21. Troubleshooting checklist
- Flow logs: does traffic hit the firewall subnet ENI?
- Route tables: private → fw endpoint → next hop.
- DNS: which Resolver rule is first? Rule order matters.
- WAF issue? Leave this chapter — open WAF logs chapter.
- FMS non-compliant resource list in console.
22. FAQ
Q. Network Firewall vs NACL?
NACL = simple subnet stateless; Network Firewall = managed Suricata/domain inspection service.
Q. DNS Firewall vs Network Firewall domain list?
DNS FW sees queries; NF domain rules see TLS/http host on traffic that passes the FW hop. Use both.
Q. Does Shield replace Network Firewall?
No. Shield = DDoS; Network Firewall = traffic policy/IPS-style.
Q. Where do I study WAF CAPTCHA?
WAF explained + hands-on chapters linked above.
Q. Can I skip host firewalls in the cloud?
No — same-SG peers and bastions still need OS locks.
Q. Where should I start learning?
Types chapter → Linux hands-on → AWS cloud firewalls → linked WAF/Shield set.
23. Interview Q&A
Q. Explain the inspection VPC pattern.
Spokes route via TGW to a central VPC hosting Network Firewall endpoints; symmetric return; central Suricata/domain policy.
Q. Stateless vs stateful rule groups in Network Firewall?
Stateless = fast 5-tuple first; stateful = Suricata/domain with connection awareness.
Q. How does Firewall Manager help?
Org-wide baseline for WAF/NF/DNS/SG so accounts cannot drift.
Q. MNC: stop malware DNS call-home.
Resolver DNS Firewall managed + custom lists; alert then block; pair with egress NF.
Q. Where does WAF sit in a layered design?
At HTTP edge (CF/ALB/API); not a substitute for SG/NF.
24. Tips in English, Marathi and Hindi
Ravindra Bagale's Tip (EN)
Draw SG → NACL → Network Firewall → DNS Firewall → WAF → Shield on one whiteboard before buying anything.
Ravindra Bagale's Tip (MR)
खरेदी आधी whiteboard: SG → NACL → NF → DNS FW → WAF → Shield.
Tip (HI)
खरीद से पहले एक बोर्ड पर SG, NACL, Network Firewall, DNS Firewall, WAF, Shield लिखें — फिर gap भरें।
Try at home
- Sketch inspection VPC for two spoke VPCs on paper.
- List which FMS policy types your org should require.
- Re-read linked WAF explained chapter objectives only.
In short
- SG/NACL deep = existing class chapter (link).
- Network Firewall = stateless + Suricata stateful + inspection VPC.
- DNS Firewall filters Resolver queries.
- FMS baselines org; WAF is HTTP edge — see WAF/Shield set.
Revision, interview and comparison cards
Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.








More cards: Ravi Sir's Cards.
Practice Tasks
London Legal LLP is a law business in London. Oliver Hughes looks after its IT and cloud work. They count money in GBP and run their AWS resources in the eu-west-2 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.
0 / 16
Easy SG is stateful on ENIs — 1
Why: Basics.
What to do: Enter 1 if Security Groups are stateful on ENIs.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy NACL is stateless on subnets — 1
Why: Basics.
What to do: Enter 1 if NACLs are stateless at subnet level.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Network Firewall stateful uses Suricata — 1
Why: Rules.
What to do: Enter 1 if NF stateful rule groups often use Suricata-compatible rules.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy DNS Firewall filters DNS queries — 1
Why: DNS.
What to do: Enter 1 if Route 53 Resolver DNS Firewall filters DNS queries.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Describe a Network Firewall
Why: CLI.
What to do: Describe firewall arn:aws:network-firewall:ap-south-1:111122223333:firewall/lab-fw
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy Tiny layer map YAML
Why: Map.
What to do: YAML keys: sg: stateful-eni, nacl: stateless-subnet, waf: http-edge.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Fill in each property with the value from the task.
- Click Check answer. Key order does not matter.
Medium Firewall Manager sets org baselines — 1
Why: Org.
What to do: Enter 1 if Firewall Manager applies org-wide baseline policies.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Inspection VPC centralizes hops — 1
Why: Pattern.
What to do: Enter 1 if an inspection VPC centralizes Network Firewall hops.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium WAF sits on HTTP paths — 1
Why: Where.
What to do: Enter 1 if WAF sits on HTTP paths (CloudFront/ALB/API) not raw VPC east-west.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Stateless NF groups are 5-tuple first — 1
Why: Order.
What to do: Enter 1 if NF stateless rule groups act like 5-tuple filters evaluated early.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium List DNS Firewall rule groups
Why: CLI.
What to do: List Resolver DNS Firewall rule groups in the account/region.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium List FMS policies
Why: CLI.
What to do: List Firewall Manager policies.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Hard Domain allow-lists curb egress — 1
Why: Egress.
What to do: Enter 1 if domain allow-lists help control egress destinations.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Delete NF lab resources for cost — 1
Why: Hygiene.
What to do: Enter 1 if you should delete Network Firewall lab resources that bill hourly.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard SG vs NACL deep dive is linked — 1
Why: No dup.
What to do: Enter 1 if this chapter links the SG vs NACL class chapter instead of duplicating it.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Keep WAF and Network Firewall roles distinct — 1
Why: Distinct.
What to do: Enter 1 if WAF and Network Firewall cover different paths/layers and often coexist.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.