AWS Builder Center
AWS Network Firewall Explained: Protect Your VPC with Managed Network Security

AWS Network Firewall Explained: Protect Your VPC with Managed Network Security

Learn how AWS Network Firewall helps protect your cloud infrastructure by monitoring and controlling network traffic entering, leaving, and moving between Amazon VPC resources. Explore firewall policies, rule groups, stateless and stateful inspection, deployment architecture, real-world use cases, security best practices, and important AWS certification concepts.

Imagine your company hosts several applications inside Amazon VPC.
Your infrastructure contains:
  • Public-facing web servers.
  • Private application servers.
  • Internal databases.
  • Multiple subnets.
  • Connections to external networks.
You want to protect these resources from suspicious traffic, unauthorized connections, and potentially malicious network activity.
Security groups and network ACLs provide important network access controls, but your organization may also need centralized firewall inspection and more advanced traffic filtering.
How can you achieve this without deploying and managing your own fleet of firewall appliances?
AWS provides a managed service for this purpose: AWS Network Firewall.
In simple terms:
AWS Network Firewall helps inspect, filter, and control network traffic across your Amazon VPC environments.
Let's understand how it works.

1. What Is AWS Network Firewall?

AWS Network Firewall is a managed network security service that helps protect Amazon VPC networks.
It provides capabilities such as:
  • Network traffic filtering.
  • Stateful traffic inspection.
  • Stateless packet filtering.
  • Domain-based traffic filtering.
  • Intrusion prevention capabilities.
  • Centralized firewall policies.
  • Network traffic monitoring.
It can help organizations control traffic between their VPC resources and external networks.
For example, an organization might configure firewall rules to allow approved outbound connections while blocking traffic associated with known malicious destinations.
Because it is managed by AWS, you do not need to maintain the underlying firewall infrastructure yourself.

2. Understanding AWS Network Firewall Architecture

Before configuring Network Firewall, it is important to understand its main components.

A. Firewall

A firewall is created within an Amazon VPC and is associated with a firewall policy.
It provides the network inspection capability through firewall endpoints deployed in supported Availability Zones.

B. Firewall Policy

A firewall policy defines how traffic should be evaluated.
It includes:
  • Stateless rule groups.
  • Stateful rule groups.
  • Default actions.
  • Other supported inspection settings.
Think of the firewall policy as the overall security rulebook.

C. Rule Groups

Rule groups contain the rules used to inspect and filter traffic.
There are two major types:
Stateless rule groups
These evaluate packets individually without tracking the state of network connections.
Stateful rule groups
These inspect traffic while tracking connection state and can evaluate traffic using more advanced rules.

D. Firewall Endpoints

Firewall endpoints are deployed in Availability Zones and receive traffic routed through the firewall.
You configure VPC route tables so that relevant traffic passes through the appropriate endpoints for inspection.

3. Stateless vs. Stateful Inspection

This is one of the most important concepts to understand.
Feature
Stateless Inspection
Stateful Inspection
Packet evaluation
Individual packets
Tracks connection state
Connection awareness
No
Yes
Inspection approach
Packet-based rules
Connection-aware rules
Common use
Basic traffic filtering
More advanced traffic inspection
Example
Allow or block based on packet properties
Inspect traffic using connection and protocol context

Stateless Example

Imagine you want to allow certain network traffic based on source IP, destination IP, protocol, or port.
A stateless rule group can evaluate packets using those properties.

Stateful Example

Imagine your application communicates with an external service over HTTPS.
A stateful rule group can inspect traffic with awareness of the connection and apply more advanced filtering rules.
Remember: Stateless inspection evaluates packets individually, while stateful inspection can track connections and apply connection-aware rules.

4. What Is Suricata in AWS Network Firewall?

AWS Network Firewall supports stateful rules compatible with the Suricata rule format.
Suricata is an open-source network threat detection and prevention engine.
It uses rules to identify and respond to network traffic patterns.
For example, a rule can match certain protocol characteristics, addresses, ports, or application-layer information.
A simplified conceptual rule might look like this:
alert tcp any any -> any 443
(msg:"Example HTTPS traffic rule"; sid:1000001;)
This illustrates the structure of a Suricata-style rule. It is not a complete production firewall policy.
Understanding Suricata is useful when working with advanced stateful inspection.

5. How Does AWS Network Firewall Process Traffic?

Let's consider an application hosted inside a VPC.
Suppose a private EC2 instance needs to communicate with an external service.
A simplified traffic flow is:
  1. The instance sends network traffic.
  1. The VPC route table directs the traffic toward the firewall endpoint.
  1. AWS Network Firewall evaluates the traffic against its configured policy.
  1. The firewall allows or blocks the traffic based on the matching rules and actions.
  1. Allowed traffic continues toward its destination.
The return traffic must also follow an appropriate routing path so that inspection and connection tracking work as intended.
Important: Correct route-table configuration is essential. An incorrectly designed routing architecture can bypass firewall inspection or create asymmetric traffic paths.

6. Real-World Example: Protecting an E-Commerce Application

Imagine an online shopping platform running in AWS.
Its architecture contains:
  • Public web servers.
  • Private application servers.
  • A private database subnet.
  • An internet gateway.
  • NAT gateways for outbound connectivity.
The company wants to:
  • Control outbound internet traffic.
  • Block access to suspicious destinations.
  • Inspect selected network traffic.
  • Monitor firewall activity.
  • Apply consistent security policies.
A possible architecture uses AWS Network Firewall to inspect selected traffic flows.
For example:
  1. Public traffic reaches the application through the approved network path.
  1. Private application servers send outbound traffic through a controlled routing path.
  1. Network Firewall evaluates the relevant traffic.
  1. Rules allow approved communication and block prohibited traffic.
  1. Firewall logs are sent to configured monitoring destinations.
  1. Security teams review suspicious activity.
This helps establish an additional layer of network protection.

7. AWS Network Firewall vs. Security Groups vs. Network ACLs

These services are often compared because they all help control network access.
However, their responsibilities are different.
Feature
Security Groups
Network ACLs
AWS Network Firewall
Applied to
Network interfaces/resources
Subnets
VPC traffic through firewall endpoints
Rule behavior
Stateful
Stateless
Stateless and stateful
Main purpose
Resource-level traffic control
Subnet-level traffic control
Centralized network inspection and filtering
Advanced inspection
Limited
Limited
Supports advanced inspection capabilities
Traffic logging
Through supported VPC Flow Logs and related services
Through supported VPC Flow Logs and related services
Dedicated firewall logging capabilities
Think of them as complementary security layers.
  • Security groups control traffic associated with resources.
  • Network ACLs control traffic at the subnet boundary.
  • Network Firewall provides additional centralized traffic inspection and filtering.

8. AWS Network Firewall vs. AWS WAF

Another important comparison is between AWS Network Firewall and AWS WAF.
Feature
AWS Network Firewall
AWS WAF
Main purpose
Network traffic filtering and inspection
Web application protection
Protection focus
Network-layer and supported protocol inspection
HTTP and HTTPS web requests
Common use
VPC network protection
Protecting web applications and APIs
Example
Control outbound network traffic
Block malicious web requests
For example:
If you want to protect a website from malicious HTTP requests, AWS WAF may be appropriate.
If you want to inspect and control network traffic passing through a VPC, AWS Network Firewall may be appropriate.
They solve different security problems and can be used together.

9. Logging and Monitoring

A firewall is more useful when you can understand what it is doing.
AWS Network Firewall supports logging that helps teams investigate traffic and firewall decisions.
Depending on your configuration, logs can be sent to supported destinations such as:
  • Amazon CloudWatch Logs.
  • Amazon S3.
  • Amazon Data Firehose.
Logging can help answer questions such as:
  • Which traffic was blocked?
  • Which rule matched a packet?
  • Are internal resources communicating with unexpected destinations?
  • Is a firewall policy blocking legitimate application traffic?
  • Are suspicious traffic patterns increasing?
For larger environments, teams can combine firewall logs with other monitoring and security services.

10. Security Best Practices

Here are some important recommendations for using AWS Network Firewall effectively:
  1. Design your VPC routing architecture before deployment.
  1. Deploy firewall endpoints in the required Availability Zones.
  1. Use centralized policies where appropriate.
  1. Apply least-privilege traffic rules.
  1. Combine firewall controls with security groups and network ACLs.
  1. Enable appropriate firewall logging.
  1. Monitor rejected traffic and unusual patterns.
  1. Test policy changes before applying them to production.
  1. Review Suricata rules carefully.
  1. Plan for high availability and resilient routing.
  1. Avoid unnecessary broad allow rules.
  1. Regularly review firewall costs and traffic-processing requirements.
A firewall policy should be designed around the application's real communication requirements.
Blocking too much traffic can break applications, while allowing too much traffic can weaken security.

11. Practical Example: Exploring AWS Network Firewall

Want to explore this service yourself?
Try this beginner-friendly exercise.
Goal: Understand how a firewall policy controls traffic inside a VPC.
Your tasks:
  1. Sign in to the AWS Management Console.
  1. Search for AWS Network Firewall.
  1. Open the service.
  1. Review the firewall creation workflow.
  1. Explore firewall policies.
  1. Compare stateless and stateful rule groups.
  1. Review the supported Suricata rule format.
  1. Explore firewall endpoint placement.
  1. Study how VPC route tables direct traffic through firewall endpoints.
  1. Review the available logging options.
For a practical deployment, use an isolated test VPC and a carefully planned routing design. Do not modify production routes while experimenting.
Also review pricing before creating firewall resources, because the service can incur endpoint and traffic-processing charges.

12. Important Concepts for AWS Certification

If you are preparing for an AWS certification, remember these concepts:
  • AWS Network Firewall: Managed network protection for Amazon VPC.
  • Firewall policy: Defines traffic inspection and filtering behavior.
  • Stateless rule group: Evaluates individual packets.
  • Stateful rule group: Tracks connections and performs connection-aware inspection.
  • Suricata: Supported rule format for stateful inspection.
  • Firewall endpoint: Receives traffic routed through the firewall.
  • Route tables: Direct traffic through the intended inspection path.
  • Firewall logging: Helps investigate network traffic and rule actions.
  • Security groups: Provide stateful resource-level network controls.
  • Network ACLs: Provide stateless subnet-level controls.
  • AWS WAF: Protects web applications from malicious HTTP and HTTPS requests.
Certification tip:
If a question asks how to deploy managed network traffic inspection and filtering for an Amazon VPC, consider AWS Network Firewall.
If the question focuses on protecting a web application against malicious HTTP requests, consider AWS WAF.

13. Hands-On Learning Challenge

Try this practical challenge:
Goal: Design a secure network inspection architecture.
Your tasks:
  • Draw a simple VPC architecture.
  • Include public and private subnets.
  • Add an AWS Network Firewall deployment.
  • Identify the required firewall endpoints.
  • Design route tables that direct selected traffic through the firewall.
  • Create a sample stateless rule group.
  • Explore a stateful rule group.
  • Identify where firewall logs should be stored.
  • Document how you would test the routing and filtering behavior.
After completing the design, explain how Network Firewall differs from security groups and network ACLs.

14. Official AWS Learning Resources

Continue learning through these official resources:

Conclusion

AWS Network Firewall provides managed network traffic inspection and filtering for Amazon VPC environments.
It helps organizations create stronger network security architectures through centralized policies, stateless and stateful inspection, and traffic logging.
Whether you are protecting application servers, controlling outbound traffic, or building a secure multi-subnet environment, understanding Network Firewall is valuable for real-world cloud security.
Remember:
A secure cloud network needs more than connectivity. It needs visibility, traffic control, and carefully designed inspection paths.



Let's Discuss!

I would love to hear your thoughts:
If you were securing an application hosted inside a private subnet, how would you combine AWS Network Firewall, security groups, and network ACLs to create multiple layers of protection?
Share your ideas in the comments. Let's learn and grow together in the AWS community!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article