Comparing AWS Security Groups and NACLs | Key Features and Use Cases

Neal Davis
4 min readJan 27, 2025

--

AWS provides a robust set of tools to secure your networking environment within a Virtual Private Cloud (VPC). Among these tools, two critical components often cause confusion: Security Groups and Network Access Control Lists (NACLs). While both serve as firewalls, they operate differently and are suited for distinct use cases.

This guide will explore their differences, features, and best practices, helping you implement them effectively in your AWS architecture.

What Do Security Groups and NACLs Have in Common?

Both Security Groups and NACLs function as firewalls to monitor and control traffic in and out of your AWS resources. A firewall acts as a barrier between trusted and untrusted networks, filtering traffic based on predefined rules.

In AWS, these firewalls operate within your VPC. VPCs provide isolation for your resources and are customizable to meet specific security needs. Both tools aim to secure your network traffic, but their scope and functionality differ.

Security Groups: Instance-Level Firewall

Where Do Security Groups Operate? Security Groups are applied directly to AWS resources such as EC2 instances, RDS databases, or ECS clusters. They act as an instance-level firewall, controlling traffic to and from the associated resources.

By default, AWS assigns a default security group to resources unless you specify a custom one. The default behavior is to allow all outbound traffic and deny all inbound traffic unless explicitly permitted.

Stateful Nature of Security Groups Security Groups are stateful, meaning any inbound traffic allowed by a rule automatically permits the corresponding outbound traffic, and vice versa.

For example, if you allow inbound HTTP traffic on port 80, the outbound response traffic is automatically allowed. This simplifies rule management for bidirectional communication.

Rules: Allow-Only Firewall Security Groups only support allow rules. This means you can permit specific traffic sources but cannot explicitly block or deny traffic.

To blacklist specific IPs or ranges, you will need to use complementary tools like NACLs.

Limits and Scalability Security Groups have the following limits: You can associate up to five Security Groups per resource by default, with an option to increase this limit to 16.

Each Security Group can contain up to 60 inbound and 60 outbound rules, managed separately for IPv4 and IPv6. These limits ensure flexibility and scalability for most use cases.

Network Access Control Lists (NACLs): Subnet-Level Firewall

Where Do NACLs Operate? NACLs are associated with subnets rather than individual instances. All resources within a subnet automatically inherit the rules of the NACL attached to that subnet.

Unlike Security Groups, which are instance-level, NACLs provide broader subnet-level control.

Stateless Nature of NACLs NACLs are stateless, meaning that rules for inbound and outbound traffic must be explicitly defined. For instance, allowing inbound HTTP traffic on port 80 requires a separate outbound rule to allow the corresponding response traffic.

This stateless nature provides greater granularity but requires more meticulous rule management.

Rules: Allow and Deny Support NACLs support both allow and deny rules. This capability allows you to explicitly block traffic from known malicious IP addresses or deny access to certain subnets.

This feature makes NACLs an excellent choice for implementing additional security layers.

Limits and Scalability Each subnet can be associated with one NACL, but a single NACL can be linked to multiple subnets.

By default, you can have up to 200 NACLs per VPC, and each NACL can include up to 20 inbound and 20 outbound rules. Like Security Groups, IPv4 and IPv6 rules are managed separately.

Key Differences Between Security Groups and NACLs

Best Practices for Security Groups and NACLs

Use Security Groups for Instance-Level Protection: Apply Security Groups to control traffic at the resource level for granular security.

Leverage NACLs for Subnet-Wide Policies: Use NACLs to enforce broader policies, such as blocking malicious IPs or restricting access to specific subnets.

Combine Security Groups and NACLs: Layer both tools to enhance defense-in-depth security.

Regularly Review Rules: Periodically audit and update rules to align with current security needs and remove unnecessary entries.

Enable Logging and Monitoring: Use AWS VPC Flow Logs to track and analyze traffic patterns, helping identify and mitigate potential threats.

Conclusion

Security Groups and NACLs are essential components of AWS VPC security, each suited for different purposes. Security Groups provide fine-grained control at the instance level with stateful rule management, while NACLs offer broader, stateless subnet-level protection with support for deny rules.

By understanding their differences and following best practices, you can design a secure and efficient AWS network architecture tailored to your needs.

Take Your Tech Career to the Next Level

On-demand Training — Ace your next cloud certification with our on-demand video courses and practice exams. Learn on your terms, and gain access to our extensive cloud training library with our monthly or yearly plans!

Cloud Mastery Bootcamp — Build job-ready cloud skills and unlock exciting cloud career opportunities with our live training program. Led by experienced instructors, you’ll develop hands-on experience with real-world projects in AWS, Linux, Python, Kubernetes and IaC!

--

--

Neal Davis
Neal Davis

Written by Neal Davis

Founder of Digital Cloud Training, IT instructor and Cloud Solutions Architect with 20+ year of IT industry experience. Passionate about empowering his students

No responses yet