AWS Cloud Certify · Practice exams

Security Specialty

AWS Network ACL (NACL) Best Practices: Rule Numbers, Ephemeral Ports and Examples

Updated November 2026 · 2 min read · Based on official AWS documentation

Quick answer

Network ACLs are stateless subnet firewalls evaluated from the lowest rule number, first match wins. Best practices: number rules in steps of 10 or 100, always allow the return traffic on ephemeral ports, place deny rules before broad allow rules, and use security groups as your main instance-level control.

How network ACLs work

Default vs custom NACL

Default and custom network ACLs
Default NACLCustom NACL
CreatedAutomatically with the VPCBy you
Starting rulesRule 100 allows all inbound and all outbound trafficOnly the * rules, so everything is denied until you add rules
The * ruleDenies anything no numbered rule matched; cannot be deletedSame

Source: docs.aws.amazon.com/vpc/latest/userguide/default-network-acl.html

NACL best practices

  1. Number rules in increments of 10 or 100, as AWS recommends, so you can insert rules later.
  2. Allow the return traffic. For every rule you add there must be a matching inbound or outbound rule for the response on the ephemeral ports.
  3. Pick the ephemeral range for your clients, or open 1024-65535 for public-facing subnets (see the table below).
  4. Put deny rules before broad allow rules. To block a malicious port inside the ephemeral range, give the deny a lower number than the rule that opens the range.
  5. Add IPv6 rules too. IPv4 and IPv6 traffic are evaluated separately, so IPv4 rules never apply to IPv6.
  6. Don't break load balancer health checks. A deny for all traffic from 0.0.0.0/0 or the subnet CIDR on backend subnets stops Elastic Load Balancing health checks.
  7. Troubleshoot with Reachability Analyzer, which can identify missing or misconfigured NACL rules.

Ephemeral port ranges

Ephemeral port ranges by client
ClientEphemeral ports
Many Linux kernels, including Amazon Linux32768-61000
Windows Server 2008 and later49152-65535
Windows through Windows Server 20031025-5000
Elastic Load Balancing1024-65535
NAT gateway1024-65535
AWS Lambda1024-65535

Source: docs.aws.amazon.com/vpc/latest/userguide/custom-network-acl.html

The client that starts the connection chooses the port. If a Windows 10 client calls a web server in your subnet, the NACL needs an outbound rule for ports 49152-65535.

Example rules for a public web subnet

Example inbound NACL rules from the AWS documentation
RulePortSourceAction
10080 (HTTP)0.0.0.0/0Allow
110443 (HTTPS)0.0.0.0/0Allow
12022 (SSH)Your network's range onlyAllow
14032768-65535 (return traffic)0.0.0.0/0Allow
*All0.0.0.0/0Deny

Source: docs.aws.amazon.com/vpc/latest/userguide/custom-network-acl.html

What a NACL cannot block

NACLs do not filter traffic to and from Amazon DNS (the Route 53 Resolver), DHCP, EC2 instance metadata (IMDS), ECS task metadata endpoints, Windows license activation, the Amazon Time Sync Service and the reserved IPs of the default VPC router. To filter DNS queries, use Route 53 Resolver DNS Firewall.

Compare NACLs with security groups in the study topic security groups, NACLs and VPC endpoints, part of Domain 3: Infrastructure Security.

Frequently asked questions

Are AWS network ACLs stateful or stateless?

Stateless. Return traffic must be allowed by an explicit rule, unlike security groups, which are stateful.

In which order are NACL rules evaluated?

From the lowest rule number up; the first matching rule is applied and the rest are skipped.

What does a new custom NACL allow?

Nothing. It only has the * rules, which deny all traffic until you add rules.

Can a NACL block DNS or instance metadata?

No. NACLs do not filter Route 53 Resolver DNS, DHCP or instance metadata traffic. Use Route 53 Resolver DNS Firewall for DNS.

Sources

AWS updates its programs and documentation. Check the linked official pages for the latest details before you decide or pay.

Practice for your AWS exam

Free practice tests with instant explanations and spaced repetition. No sign-up.

Start a practice test Security Specialty hub

Keep reading