

# Best practices for writing Suricata compatible rules for AWS Network Firewall

These best practices apply to the Suricata compatible stateful rules you write for a Classic AWS Network Firewall stateful rule group and for the IPS rule group of a Next Generation policy, which use the same rule syntax. Suricata is an open source network intrusion prevention system (IPS) that includes a standard rule-based language for stateful network traffic inspection. These practices don't apply to firewall rules in a Next Generation policy, which use firewall-mode syntax; for those, see [Working with firewall rule groups in AWS Network Firewall](firewall-rule-groups.md). 

When you write your stateful rules, verify the configuration of the firewall policy where you intend to use them, so that all of your rules evaluate the way you want. For how a Classic AWS Network Firewall policy handles traffic and when it sends traffic to the stateful engine, see [How AWS Network Firewall filters network traffic](firewall-policy-processing.md). In a Next Generation policy, the firewall engine forwards accepted traffic to the IPS engine; for more information, see [Next Generation policies](firewall-policies-v2.md). 

For example, many stateful rules rely on seeing a complete bidirectional traffic flow for correct evaluation, such as rules with options like `flow:established`. In a Classic AWS Network Firewall policy, configure your stateless rules and default actions to forward traffic in both directions to the stateful engine; for these action options, see [Defining rule actions in AWS Network Firewall](rule-action.md). A Next Generation policy has no stateless rule groups—its firewall engine forwards accepted traffic to the IPS engine in both directions when your firewall rules accept the connection. 