When it comes to inspecting network traffic, many security teams want two things from a firewall. They want to allow only the traffic each application needs, and they want each allowed connection checked for known threats. Today, you can do both with AWS Network Firewall, a stateful, managed network firewall and intrusion detection and prevention service. In a Classic policy, your access rules and your threat rules run together in one stateful engine and share one rule capacity.
With Next Generation policies, access control and threat protection each get their own engine in the same firewall. A firewall engine allows the traffic you approve and drops the rest. An intrusion prevention system (IPS) engine checks the allowed traffic with AWS managed rule groups or with rules that you write. Each engine has its own rule capacity, so adding access rules doesn’t take capacity away from threat protection.
In this post, we walk through what Next Generation policies are, how they evaluate traffic, and the new concepts they introduce. We use sample records to cover what each engine logs and how to validate a policy with the new monitor mode. To put it all together, we walk through creating an example Next Generation policy.
How a Next Generation policy works
A Next Generation policy inspects traffic with two engines, in sequence. Traffic that the firewall engine allows moves to the IPS engine, and traffic that the firewall engine blocks goes no further. The firewall engine is drop by default, and the IPS engine is pass by default.
If you already write Suricata rules, the two engines will feel familiar. The firewall engine is built on Suricata 8 firewall mode, which follows each connection as it progresses and evaluates rules at each step. The IPS engine uses the Suricata compatible intrusion detection system (IDS) and IPS rules that you already know from the stateful engine in a Classic policy, with one difference: it evaluates rules in action order and doesn’t support Classic options such as strict order.
A Classic policy uses a stateless engine and then a stateful engine that evaluates access rules and threat rules together. In a Next Generation policy, both engines are stateful, so each rule is evaluated with full connection context, which helps keep traffic handling consistent and predictable. The firewall engine works up to the application layer. It follows each connection for its entire flow, from the first packet through the TCP handshake and application layer exchanges such as the TLS client hello, and evaluates your access rules along the way (Figure 1).
Figure 1: Classic and Next Generation policy engines and their rule capacity.
This separation changes how you design a policy. Because each engine has one job, you can plan access control and threat protection on their own, and different teams can work independently. For example, a networking team can manage access rules while a security team handles threat detection, and neither has to rewrite the other’s rules.
The firewall engine controls access
You configure access control by specifying an action for a protocol, along with a source and destination. Rules run in the order that you set. Traffic that no rule allows gets the policy’s firewall default action, which is drop unless you change it. In a Next Generation policy, the drop default action applies from the first packet, so for TCP traffic the firewall can drop the initial SYN. Unlike the drop established default action in a Classic policy, it doesn’t wait for a connection to be established.
A few terms explain how the firewall engine evaluates traffic. Connection states are the protocol states that a connection progresses through, such as the TCP handshake and the TLS client hello. A hook is the point at a connection state where your rules attach, so a rule’s hook sets when the firewall engine evaluates it. Each rule also has an action, such as accept, drop, or reject. Its action scope sets how much of the traffic the action applies to, from one packet or one transaction up to the whole connection, called the flow. For more details, see Firewall engine hooks.
When you build a rule in the console, you choose a protocol and then two settings: Connection state, which sets the rule’s hook, and Action scope. For example, to allow a domain over TLS, you match its server name at the Client Hello connection state with the This flow action scope.
Because the firewall engine is drop by default, a connection advances to the next connection state only while your rules keep accepting it. For example, a connection can pass the TCP handshake and still be dropped at the TLS client hello. That happens when its server name isn’t on your approved list (Figure 2).
Figure 2: A connection is accepted at the TCP handshake hook and dropped at the TLS client hello hook.
In Figure 2, the rule for www.amazon.com accepts the flow when it matches the server name at the TLS client hello hook. No rule accepts example.com at that hook, so the firewall default action drops it.
You don’t have to write every rule in raw Suricata syntax. You can build rules in the console rule builder, or, as in the example later in this post, enter your domains in a domain list rule group, and Network Firewall builds the rules for you.
Action scope also sets where an accepted connection goes next. An accept with the hook scope allows the connection to advance to the next connection state, where the rules at that hook evaluate it. An accept with the flow scope lets the connection skip the remaining hooks and move to the IPS engine (Figure 3). A firewall rule can also bypass the IPS engine for specific traffic when you choose. For the valid combinations of action and scope at each type of hook, see Firewall engine actions and scopes.
Figure 3: An accept with the hook scope compared with an accept with the flow scope.
The IPS engine looks for threats
Traffic that the firewall engine allows then reaches the IPS engine, which inspects it with Suricata compatible rules. The IPS engine is designed to look for specific threats, so it blocks only traffic that matches a threat rule. IPS rules evaluate in action order. Pass rules go first, then drop, reject, and alert rules, regardless of the order in which you define them. For the full path through both engines, see How Network Firewall filters traffic with a Next Generation policy.
We recommend that you start with the AWS managed rule groups. Because the IPS engine is built on the industry standard Suricata engine, you can also run Suricata compatible rule sets from specialized security providers, alongside rules that you write yourself.
Referenced rule groups and embedded rules
Each engine gets its rules from its own section of the policy. You can add rules in two ways and mix both in one section.
Referenced rule groups are separate resources, and they’re the only kind of rule group that Classic policies support. You create a rule group once and add it to as many policies as you need. You can also share it with other accounts through AWS Resource Access Manager (AWS RAM). For details, see Sharing AWS Network Firewall resources. When you update the rule group, each policy that references it picks up the change. You set a referenced rule group’s capacity when you create it, and you can’t change it afterward, so leave room for it to grow.
Embedded rules are new with Next Generation policies. You write them directly inside one policy, and they belong to that policy only, so you can’t share them with another policy. Use them to add rules quickly that are specific to that policy. They use that engine’s rule capacity, and you don’t set a capacity up front. Embedded rules in both engine sections share a combined limit. For all limits, see AWS Network Firewall quotas.
Read what each engine logs
Whichever way you add rules, both engines write to the same alert and flow logs, which you configure in the logging configuration. Each alert record carries new fields that show which engine wrote it and, for the firewall engine, the hook where the decision happened.
The following record came from a test, in enforce mode, of the example policy that you build later in this post. A host tried to reach example.com, which isn’t on the allow list.
The following table explains the key fields in this record.
| Field | Value | What it tells you |
| alert.engine | fw | The firewall engine wrote this record. |
| firewall.hook | tls:client_hello | The decision happened at the TLS client hello, where the client sends the server name example.com. |
| alert.signature | SURICATA FW default app policy | No rule matched, so the firewall default action applied. The default action logs its drops on its own, so you don’t need an alert rule to see what it blocks. |
| firewall.policy | drop:flow,alert | The action and scope that applied. The default action dropped the whole flow and wrote an alert. |
| aws_metadata.resource_arn | arn:aws:network-firewall:us-east-1:111122223333:firewall-policy-v2/example-policy | The policy itself is the source, because the record doesn’t come from one of your rule groups. |
When a connection that the firewall engine allowed matches a threat rule, the IPS engine writes its own record. In this test, the firewall engine allowed TLS to one test server by IP address. The IPS section also held the following embedded rule, which drops TLS connections with a JA4 fingerprint that your threat intelligence flags. The fingerprint in this rule is a sample value:
This is a sample rule to show the IPS engine at work. In your own policies, we recommend that you start with the AWS managed threat signature rule groups and add custom rules where you need them.
A test client with that fingerprint connected to that server without a server name, and the IPS engine wrote the following record.
| Field | Value | What it tells you |
| alert.engine | td | The IPS engine wrote this record. IPS records have no firewall object, because IPS rules don’t use hooks. |
| tls.ja4 | t13d1516h2_aaaaaaaaaaaa_bbbbbbbbbbbb | The JA4 fingerprint of the client, which matches the fingerprint in the rule. |
| alert.signature | Example: flagged TLS client fingerprint (JA4) | The IPS rule that matched, from the rule’s msg option. |
| alert.category | A Network Trojan was detected | The rule’s classtype, trojan-activity, sets this category. |
| verdict.action | drop | The IPS engine dropped the connection. |
| aws_metadata.resource_arn | arn:aws:network-firewall:us-east-1:111122223333:firewall-policy-v2/example-policy | The rule is embedded in the policy, so the record shows the policy ARN. A match from an AWS managed rule group or one of your referenced rule groups carries that rule group’s ARN instead. |
To separate access control events from threat events in your queries, filter on the engine field. To find which rule group produced an event, use resource_arn. Embedded rules and the default action show the policy ARN.
Validate in monitor mode, then enforce
Each Next Generation policy has a policy mode, enforce or monitor. In enforce mode, the engines apply their actions. In monitor mode, both engines evaluate your traffic and log what they would do. Your rules and the default action don’t drop or reject traffic.
Monitor mode also turns on alert logging for your rules and the default action, so each firewall rule that would block traffic logs its matches. That makes monitor mode a lower-risk way to stage a rollout of a new policy or a change to an existing one. Monitor logs are close to enforce mode but can differ. When a firewall rule would block a connection, monitor mode lets the connection through but sends it past the IPS engine, just as a blocked connection never reaches the IPS engine in enforce mode. So the monitor logs don’t show IPS alerts for that connection. For the full list of differences, see Policy mode: enforce and monitor.
To validate a policy in monitor mode:
- Set Policy mode to Monitor, and confirm that alert logging is on for the firewall. Amazon Route 53 Resolved IP Validation still applies its configured action in monitor mode, so if your policy uses it, set its action to Alert.
- Send representative traffic for long enough to cover your normal patterns.
- In your alert logs, filter on engine = fw. Check the
FirewallDefaultActionAppliedmetric in Amazon CloudWatch. Traffic that you meant to allow shouldn’t be reaching the default action. - When the results look right, switch Policy mode to Enforce during a maintenance window. Changing the policy mode or the firewall default action restarts stateful inspection on the firewall, which interrupts established connections.
Example policy with a domain allow list and threat protection
The following example puts the engines, logs, and monitor mode together. It allows outbound traffic only to approved domains and checks that allowed traffic for known threats. The firewall engine holds the domain allow list, and the IPS engine runs the AWS active threat defense managed rule group. Figure 4 shows the policy and where each of the earlier log records comes from. Log record 2 comes from the sample embedded rule, which isn’t part of the policy that you create in the following steps.
To create the domain list rule group:
- In the Network Firewall console, choose Network Firewall rule groups, and then choose Create rule group. Choose Next Generation as the rule group version, Firewall rule group as the type, and Domain list as the format.
Figure 5: Choosing the rule group version, type, and format for the domain list.
- Enter one domain per line, for example
.amazon.comandcheckip.amazonaws.com, and under Protocols, select HTTPS only. For HTTPS, the firewall matches the TLS Server Name Indication (SNI) without decrypting traffic. SNI is the server name that a client sends at the start of a TLS connection. To include a domain and its subdomains, start the name with a dot. - For Capacity sizing, choose Allow room to grow, and then create the rule group.
To create the policy:
- Choose Firewall policies, and then choose Create firewall policy. Select Next Generation as the policy version and Drop as the firewall default action, so the firewall blocks traffic that you don’t allow. Set Policy mode to Monitor. We recommend rolling out a new policy in monitor mode first, then switching to enforce after you validate it. Enable Active Threat Defense is selected by default. Active threat defense is optional. Additional charges apply; for details, see AWS Network Firewall pricing.
Figure 6: The policy details page, with Next Generation, Drop, and Monitor selected.
- On the Add firewall rule groups step, add the domain list rule group that you created in the previous procedure.
- On the Add IPS rule groups step, the active threat defense managed rule group, listed as AttackInfrastructure, is already added. It comes from the Enable Active Threat Defense default that Figure 6 shows. Choose Add rule group to add more AWS managed rule groups, your own rule groups, or embedded rules.
- Create the policy, associate it with your firewall, and turn on alert and flow logging.
- After you validate the policy, as described in Validate in monitor mode, then enforce, switch Policy mode to Enforce.
For more detail, see Creating a rule group for a Next Generation policy and Generating firewall rules from domain names.
Already using Classic policies?
Classic Network Firewall policies remain supported, and your existing firewalls keep running as they are. Each firewall uses one policy type at a time, either a Classic policy or a Next Generation policy. For new firewalls, we recommend Next Generation policies. We’re working on migration guidance for existing policies, so you can plan a move when it suits you.
To try one now, create a test firewall with a Next Generation policy and start it in monitor mode. To compare the two policy types, see AWS Network Firewall firewall policy versions. Next Generation policies are available at no additional charge. You pay the standard Network Firewall charges for your firewall endpoints and the traffic they process. For Regions and pricing, see AWS Services by Region and AWS Network Firewall pricing.
Conclusion
In this post, we showed you how a Next Generation policy gives access control and threat protection separate engines, each with its own rule capacity, so you can grow your firewall rules and IPS rules independently. We also showed what each engine logs, how to validate a policy in monitor mode, and how to build a policy that allows only approved domains and checks the allowed traffic for threats. To learn more, see Getting started with a Next Generation policy, and to automate your policies, use the AWS Command Line Interface (AWS CLI) or the AWS SDKs.
If you have questions about this post, contact AWS Support or start a new thread on AWS re:Post.

