AWS Network Firewall
Managed stateful and stateless VPC firewall with Suricata IPS rules, domain filtering and endpoint-based routing.
Exam tasks: 3.3 (Network Firewall; north/south and east/west protection)
The decision: does the control need to filter by domain, signature or payload across a whole VPC, rather than by address and port?
AWS Network Firewall is a managed, stateful network firewall and intrusion detection and prevention service for a VPC. It filters traffic to and from an internet gateway, NAT gateway, VPN or Direct Connect. It is built on the open source IPS Suricata and accepts Suricata compatible rules. Traffic reaches it only because you change route tables to send it through a firewall endpoint.
Components
| Component | What to remember |
|---|---|
| Firewall | The resource tied to a VPC. Has one subnet per Availability Zone for its endpoint, each needing a free IP |
| Firewall policy | Holds stateless and stateful rule groups plus default actions. One firewall uses exactly one policy. One policy can serve many firewalls, so a change hits all of them |
| Rule group | A reusable set of rules. Stateless or stateful |
| Firewall subnet | Dedicated to the endpoint. The endpoint cannot filter traffic in its own subnet, so put nothing else there |
| VPC endpoint association | Adds extra endpoints, in the same VPC or another |
Deployment
- Firewall endpoints sit in dedicated subnets, one per AZ, with route tables sending traffic through them.
- Or attach the firewall natively to a transit gateway, where AWS manages the inspection VPC and you route with transit gateway route tables.
- Forward traffic from the stateless engine to the stateful engine by default unless you have a reason not to.
Stateless versus stateful
| Stateless engine | Stateful engine | |
|---|---|---|
| Looks at | One packet at a time, 5-tuple (source and destination IP and port, protocol) and TCP flags | Whole flow in context, direction and application protocol |
| Actions | Pass, drop, forward to stateful | Pass, drop, reject, alert |
| Order | Priority number, lowest first | Action order (pass, drop, reject, alert) or strict order where you set exact order |
| Extras | Custom action that publishes CloudWatch metrics | Suricata compatible rules, domain lists, protocol detection, TLS inspection |
The stateless engine runs first. The policy's stateless default action decides what happens to unmatched packets, for example drop or forward to the stateful engine.
Exam signal
"Allow outbound traffic only to approved domains", "IPS for the VPC", "inspect traffic between VPCs through Transit Gateway" or "filter VPN and Direct Connect traffic": Network Firewall. It also gives deep packet inspection that security groups and NACLs lack.
Stateful rule group types
- Domain list allows or denies by HTTP
Hostheader and TLS SNI, including wildcards like.example.org. - Standard stateful (5-tuple) rules are simpler than Suricata.
- Suricata-compatible IPS rules match on protocol fields, content and signatures, with
pass,drop,rejectandalert. - AWS managed threat signatures and domain lists cover malware, botnet command and control, and crypto mining.
- Strict order evaluates rule groups in the priority you set and lets you define default actions like "drop established" for anything not explicitly passed. The older action order evaluates all pass rules, then drop, then alert. Use strict order for allow lists.
- TLS inspection decrypts, inspects and re-encrypts traffic with certificates from ACM, for inbound and outbound flows. Without it, the firewall only sees SNI and certificate metadata, not the payload.
Strict order default actions
When a policy uses strict order you can set default actions for packets no rule matched.
- Drop actions. Choose none or one of drop all, drop established, or the two application drop variants.
- Alert actions. Choose any combination, including alert all and alert established.
- For your own domain list rule groups, pick drop established. The firewall needs an established connection to evaluate a domain.
A domain allow list without a default drop
Adding a domain list that allows .amazonaws.com and .github.com doesn't block anything else in action order
mode, because the stateful default is to pass. Use strict order with a default action of drop established (or a
deny-all rule last), or the allow list is decorative.
Logging
Logging covers only traffic sent to the stateful engine. Log types are flow, alert and TLS (needs TLS inspection configured). Alerts are produced for drop, alert and reject actions. CloudWatch metrics cover both engines.
Network Firewall versus neighbors
| Need | Pick |
|---|---|
| Domain filtering of DNS queries at the resolver | Route 53 Resolver DNS Firewall |
| Domain filtering of actual connections, IPS rules | Network Firewall |
| HTTP layer rules on ALB, CloudFront, API Gateway | AWS WAF |
| Centralized rollout to every account | Firewall Manager Network Firewall policy |
DNS Firewall cannot see connections and Network Firewall cannot see queries made to the VPC resolver. Combine them for resolved IP validation.
Exam trap
Creating a firewall does nothing until route tables send traffic through the endpoint. A scenario where traffic still bypasses the firewall points to missing routes, not missing rules.
Legacy
Older material pairs "IDS/IPS software on EC2" with Traffic Mirroring. Network Firewall is the managed in-line option today.
Related
Further reading
Network ACLs and Ephemeral Ports
Stateless subnet firewall rules, rule ordering, and the ephemeral port ranges you must open for return traffic.
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.