Skip to Content
Asterrr's Handbook
3 · Infrastructure security

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.

VPCFirewall subnetProtected subnetroute tableinspectedalertsFirewallendpointWorkloadInternet gatewayInternetAlert and flowlogs
Internet traffic is routed through a firewall endpoint in a dedicated firewall subnet before it reaches the protected subnet. Alerts go to logs.

Components

ComponentWhat to remember
FirewallThe resource tied to a VPC. Has one subnet per Availability Zone for its endpoint, each needing a free IP
Firewall policyHolds 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 groupA reusable set of rules. Stateless or stateful
Firewall subnetDedicated to the endpoint. The endpoint cannot filter traffic in its own subnet, so put nothing else there
VPC endpoint associationAdds 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 engineStateful engine
Looks atOne packet at a time, 5-tuple (source and destination IP and port, protocol) and TCP flagsWhole flow in context, direction and application protocol
ActionsPass, drop, forward to statefulPass, drop, reject, alert
OrderPriority number, lowest firstAction order (pass, drop, reject, alert) or strict order where you set exact order
ExtrasCustom action that publishes CloudWatch metricsSuricata 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 Host header 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, reject and alert.
  • 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

NeedPick
Domain filtering of DNS queries at the resolverRoute 53 Resolver DNS Firewall
Domain filtering of actual connections, IPS rulesNetwork Firewall
HTTP layer rules on ALB, CloudFront, API GatewayAWS WAF
Centralized rollout to every accountFirewall 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.

Further reading

On this page