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.
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
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
A Network Firewall endpoint only inspects packets that a route sends to it. Draw a workload subnet, firewall endpoint and destination. Follow the forward path on one set of arrows and the reply on another. If they use different stateful inspection paths, the firewall may not recognise the return as part of the same connection. When reading the lab design, point at the route table and endpoint for both directions instead of expecting a resource that exists to see all traffic automatically.
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
Read DNS Firewall as a control on a name lookup. In the example, an app asks the VPC Resolver for a domain. A rule can allow, alert on or block that question. Compare it with an application that already has an IP address and opens a connection. That action does not create the same DNS question. Choose a network firewall or another approved egress control when you need to decide about the connection itself. The web firewall answers a further question about an HTTP request.
Filters DNS queries from VPCs through Resolver. Domain lists (AWS managed threat lists or your own) with allow/block/alert actions. A block rule can stop a name lookup before an HTTPS connection starts, when the query goes through the VPC Resolver. The rule checks the domain in the DNS query. Use a separate network control for outbound connections to IP addresses.
- 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
On paper mark the path of a permitted connection, a blocked DNS lookup and a reply routed through a different endpoint. For each, write which layer has enough information to show the problem. Include the expected result and the log or diagram evidence. Leave real route-table changes to a dedicated lab and return it to its starting routes afterward.
Use a dedicated lab account. Budget alert first. Region ap-south-1 unless blocked.
- 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.
Practise this chapter
Interview questions and answers
A Network Firewall endpoint was created, but it sees none of a subnet’s traffic. What do you investigate?
Trace the forward and return routes through the firewall endpoint. The endpoint only inspects traffic routed to it. A stateful design also needs consistent paths. Draw the route-table targets and compare them with flow and firewall evidence before changing policy.
Check your understanding
Choose an answer, then compare your reasoning with the explanation.
Practice Tasks
Practice checks run in your browser. They check the answer for this exercise; they do not create resources or connect to your AWS account.
About this scenarioLondon 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 Track a response
An ENI can send a request under its security group. The response is accepted even without a separate inbound rule for that connection. What property explains this?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Easy Check both subnet directions
An inbound packet matches a network ACL allow rule. Its reply still needs a separate outbound allow. What property explains this?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Easy Read a rule language
Which open-source intrusion detection and prevention engine supplies the rule syntax used by AWS Network Firewall stateful signature rules?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Easy Filter before the connection
A team wants to deny queries for a listed domain at the VPC resolver. Name the AWS resolver firewall feature.
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Easy Describe a Network Firewall
CLI.
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
Map.
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 Manage guardrails across accounts
Several member accounts in one AWS Organization must use the same firewall policy. Which AWS service centrally manages that policy?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Medium Name the shared VPC role
Traffic from several application VPCs is routed through a dedicated VPC that hosts firewall endpoints. What is this VPC commonly called?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Medium Choose the HTTP control
Your CloudFront distribution needs request rules for the URL path and HTTP headers. Name the AWS firewall service for this layer.
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Medium Count packet match fields
A stateless filter matches source IP, destination IP, source port, destination port and protocol. How many distinct fields are listed?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Medium List DNS Firewall rule groups
CLI.
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
CLI.
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 Approve known destinations
A payroll worker should connect only to the vendor hostnames that have been reviewed. What kind of domain list expresses that policy?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Hard Stop idle firewall charges
A disposable Network Firewall lab has ended. What resource action should you take on its dedicated firewall after removing routes that need it?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Hard Choose a subnet control
The rule needs an explicit subnet-level deny. Which AWS VPC control can express it?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Hard Choose the VPC traffic layer
Your app already uses WAF for web requests. You also need a managed AWS firewall to inspect routed VPC flows. Which service fits that second role?
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.