Arkinu
AWS service comparison

AWS Network Firewall vs AWS WAF: differences and when to use each

AWS Network Firewall
AWS WAF

Often confused on the examQuestions tend to offer one as a distractor for the other: look for the phrase in the scenario that tips the balance.

Security, Identity, and Compliance

AWS Network Firewall

Managed, stateful network firewall with intrusion detection and prevention for your VPCs. It filters traffic at the perimeter of the VPC, for example traffic that goes through an internet gateway, a NAT gateway, a VPN, or AWS Direct Connect.

Exam phrases that point here

  • «filter outbound traffic from the VPC based on domain name»

    AWS Network Firewall can allow or block outbound connections based on the domain (for example, using the HTTPS SNI or the HTTP URL), something a security group or a network ACL cannot do because they filter only by IP address, port, and protocol.

    When not: If what needs to be filtered is web requests that reach an application (SQL injection, cross-site scripting) on CloudFront, an Application Load Balancer, or API Gateway, the answer is AWS WAF. If it is enough to allow ports and IP addresses per instance, security groups are sufficient.

  • «inspect all VPC traffic with an intrusion prevention system (IPS)»

    Network Firewall includes a stateful engine that can detect and block traffic based on known attack signatures, inline with the traffic of the entire VPC.

    When not: If the scenario asks to detect threats by analyzing logs without sitting in the path of the traffic, it points to Amazon GuardDuty. GuardDuty alerts; Network Firewall filters.

  • «centralized inspection of traffic between VPCs and to the on-premises network»

    With AWS Transit Gateway, traffic between VPCs or to Direct Connect and VPN can go through a single managed firewall instead of deploying one in every VPC.

    When not: If you only need to connect the networks, without inspecting, Transit Gateway is enough. And if the VPCs are connected by VPC peering, be careful: Network Firewall does not support inspecting that type of connection.

  • «managed network firewall with stateful rules to protect the VPC»

    It is a firewall managed by AWS that scales with traffic and applies stateful rules at the VPC level, without installing or maintaining appliances.

    When not: If the problem is a volumetric DDoS attack, Network Firewall is not designed for that: think of AWS Shield Advanced. If the ask is to apply the same firewall policies across many accounts, AWS Firewall Manager comes in.

  • «block communication with known malicious domains and IP addresses»

    Network Firewall offers rule groups managed by AWS, including some based on Amazon threat intelligence, which you turn on without writing the rules by hand.

    When not: Network Firewall does not inspect the queries that EC2 instances make to the AWS-provided DNS (AmazonProvidedDNS); if the requirement is to filter those DNS queries, the solution lies elsewhere (for example, Route 53 Resolver DNS Firewall).

Study AWS Network Firewall →

Security, Identity, and Compliance

AWS WAF

Web application firewall that inspects HTTP(S) requests sent to resources such as Amazon CloudFront, Application Load Balancer, Amazon API Gateway, or Amazon Cognito user pools. Based on rules you define, such as the source IP address or query string values, it allows or blocks the request.

Exam phrases that point here

  • «protect the web application against SQL injection and cross-site scripting»

    AWS WAF inspects the HTTP(S) requests that arrive at, among others, CloudFront, an ALB, API Gateway, or AppSync, and blocks common attack patterns, often with managed rules.

    When not: If the attack is a layer 3/4 network flood (for example, a SYN flood), the protection comes from AWS Shield. And if you need to filter non-HTTP traffic inside a VPC, AWS Network Firewall or security groups fit.

  • «limit the number of requests per IP address»

    A rate-based rule counts the requests from each IP over a time window and applies an action to those that exceed the limit.

    When not: If the ask is to limit the calls of each API client according to their plan, that is solved with Amazon API Gateway throttling and usage plans, not with WAF.

  • «block requests that come from certain countries»

    WAF can filter by the country of origin of the IP (geographic match) and combine it with other conditions.

    When not: If it is enough to block countries for all the content of a distribution, CloudFront geographic restriction also solves it without a web ACL.

  • «block malicious IP addresses before they reach the Application Load Balancer»

    A web ACL associated with the ALB can block an IP set at the application layer.

    When not: If the block must apply to any protocol in a subnet, you use a network ACL (security groups have no deny rules). WAF also cannot be associated with a Network Load Balancer.

  • «stop bots and brute-force attacks against the login page»

    WAF combines rate-based rules on the login path, Bot Control, and the Account Takeover Prevention managed rule group.

    When not: If the scenario is about authenticating users, MFA, or federation, the service is Amazon Cognito or IAM, not WAF.

Often paired with

  • Amazon CloudFront
  • Elastic Load Balancing (ELB)
  • Amazon API Gateway
  • Amazon Cognito
Study AWS WAF →