Skip to content

Network Access Control List (NACL) inside AWS

Application Based Stickyness in ALB in AWS

A network access control list (ACL) allows or denies specific inbound or outbound traffic at the subnet level. You can use the default network ACL for your VPC, or you can create a custom network ACL for your VPC with rules that are similar to the rules for your security groups in order to add an additional layer of security to your VPC.

The following diagram shows a VPC with two subnets. Each subnet has a network ACL. When traffic enters the VPC (for example, from a peered VPC, VPN connection, or the internet), the router sends the traffic to its destination. Network ACL A determines which traffic destined for subnet 1 is allowed to enter subnet 1, and which traffic destined for a location outside subnet 1 is allowed to leave subnet 1. Similarly, network ACL B determines which traffic is allowed to enter and leave subnet 2.


      A VPC with two subnets and a network ACL for each subnet.

Network ACL basics

  • Each subnet in your VPC must be associated with a network ACL. If you don’t explicitly associate a subnet with a network ACL, the subnet is automatically associated with the default network ACL.
  • A network ACL has inbound rules and outbound rules. Each rule can either allow or deny traffic. Each rule has a number from 1 to 32766. We evaluate the rules in order, starting with the lowest numbered rule, when deciding whether allow or deny traffic. If the traffic matches a rule, the rule is applied and we do not evaluate any additional rules. We recommend that you start by creating rules in increments (for example, increments of 10 or 100) so that you can insert new rules later on, if needed.
  • NACLs are stateless, which means that information about previously sent or received traffic is not saved. If, for example, you create a NACL rule to allow specific inbound traffic to a subnet, responses to that traffic are not automatically allowed.

Network ACL rules

You can add or remove rules from the default network ACL, or create additional network ACLs for your VPC.

  • Rule number. Rules are evaluated starting with the lowest numbered rule. As soon as a rule matches traffic, it’s applied regardless of any higher-numbered rule that might contradict it.
  • Type. The type of traffic; for example, SSH. You can also specify all traffic or a custom range.
  • Protocol. You can specify any protocol that has a standard protocol number. For Example ICMP , TCP , UDP .
  • Port range. The listening port or port range for the traffic. For example, 80 for HTTP traffic.
  • Source. [Inbound rules only] The source of the traffic (CIDR range).
  • Destination. [Outbound rules only] The destination for the traffic (CIDR range).
  • Allow/Deny. Whether to allow or deny the specified traffic.

Click Here to Learn about Difference Between Security Groups and NACL