Abstract layered illustration of AWS Security Groups vs NACL showing architecture-first network security design

Network Security by Design: Security Groups, NACLs, and VPC Architecture

AWS Security Groups vs NACL: Introduction

It is a mistake to frame AWS Security Groups vs. NACL as either one to the exclusion of the other. Treating Security Groups as perimeter firewalls is flawed because they protect individual resources rather than defining the outer boundary of a VPC. Likewise, deploying NACLs for microsegmentation of individual resources results in rule complexity that is impossible to maintain. Also, mixing stateless and stateful rules creates its own maintenance issues along with misunderstanding layers at subnet boundaries.

Both Security Groups and NACLs serve vital complementary roles in AWS security posture and therefore are not interchangeable. Their roles are mapped to stateful and stateless enforcement, respectively. These are, in turn, mapped to session and packet levels, respectively. They also work at different boundary levels with Security Groups operating at the workload-level and NACLs at the subnet-level. Subsequently, substituting one for the other collapses these layers and misaligns enforcement at the session and packet levels.

However, when deploying both as complementary, it is crucial to perform network traffic modeling to deploy them correctly. The next step is to properly define the network’s trust boundaries so as to optimally group resources with similar trust signatures. After this, enforce the trust boundaries by segmentation represented by VPCs, subnets, and route tables. Finally, deploy NACLs and Security Groups as gatekeepers, ensuring policy is the outcome, not the starting point.

Amazon VPC as the Security Boundary

VPC as the Macro Boundary

Diagram of AWS Security Groups vs NACL trust boundary stack showing AWS account, VPC, subnet, and workload layers

Virtual Private Clouds (VPCs) are the highest level of segmentation within the AWS ecosystem and map to trust boundaries defined at the broadest level. In network terms, they define the IP address space ownership for all resources within the VPC, typically expressed as a CIDR block. They also define the controlled ingress and egress paths that enforce explicit trust, making security control a bounded space. By limiting communication paths to a fixed space, they contain the blast radius for any compromised or contaminated resources. Furthermore, explicit routing requirements further limit the communication paths, reducing the attack surface area. This forms the foundation for account-level separation.

Subnets Define Exposure Levels

VPCs define trust at the broadest level across resources that are aligned with a coherent mission. Subnets within a VPC group workloads around a common tier and limit exposure to those workloads. The broadest categorization of exposure is public versus private, where tiers either have public or private exposure. This translates into tiers that are internet-facing for public exposure. This contrasts with tiers that are internal routing, whose exposure is private. Furthermore, architects can establish constraints upon lateral communication between these subnets and further control exposure. This further reduces the blast radius by isolating tiers from one another.

Routing Determines Reachability

Subnets limit the exposure of resources within their respective tiers, but these resources still need to communicate outside the VPC. Hence, defining these communication paths to VPC external entities is critical to constrain malicious activity. Furthermore, these paths reduce the set of outcomes that policies need to manage and simplify policy design. The paths are defined by route tables, which ultimately determine the reachability of VPC resources by entities external to VPC. However, route tables do not prevent communication between different subnets within AWS VPC, which is the job of Security Groups and NACLs. Route tables still play an important role since they limit exposure by external gateways, and misrouting undermines segmentation.

AWS Security Groups and NACL Enforcement Come After Structure

AWS VPCs, subnets, and route tables establish the boundary structure for resources and their exposure. Only then can architects consider the controls that enforce these structures, AWS Security Groups vs NACLs, but they are complementary. In other words, reachability of resources is defined prior to considering the restriction of these paths. Hence, AWS Security Groups and NACL enforce policy upon these established paths. Hence, they refine but never replace the architecture.

Security Groups vs NACL in AWS

Enforcement Model: Stateful vs Stateless

Diagram comparing AWS Security Groups vs NACL showing stateful connection tracking versus stateless packet evaluation

Security Groups vs NACL in AWS is the implementation, but conceptually, it is stateful vs stateless. NACLs are stateless, whereas Security Groups are stateful. Stateful enforcement is session-aware connection tracking. It remembers the state of the connection. Specifically, they remember the source and destination addresses and their ports, along with the protocol for each connection. Hence, they can permit the return traffic associated with that connection. Meanwhile, NACLs are stateless since they operate at the packet-level evaluation and do not maintain memory of transmissions. The implication is that engineers must explicitly specify bidirectional rule requirements. In contrast, stateful models reduce rule duplication since they can track each connection. Consequently, stateless models have increased rule surfaces since each path needs to be specified. Therefore, more elaborate traffic patterns will increase the enforcement complexity of stateless firewalls such as NACLs.

Boundary Scope: Workload vs Subnet

Diagram of AWS Security Groups vs NACL comparing workload-level ENI scope and subnet-level boundary enforcement

AWS Security Groups vs NACLs is also framed as workload vs subnet with regard to boundary scope; they operate at different boundaries. In terms of AWS components, Security Groups map directly to Elastic Network Interfaces (ENIs). An ENI is attached to a resource, e.g. EC2 instance, and acts as the network attachment point for a workload inside a VPC. Meanwhile, NACLs map to subnets, and enforcement is across the subnet and not individual workloads. Another difference is that Security Groups establish trust per-resource while NACLs provide shared subnet guardrail controls. Additionally, Security Groups establish paths between resources through Security Group-to-Security Group referencing. In contrast, NACLs enforce uniform policy across all subnet resources.

AWS Security Groups vs NACL: Rule Evaluation

Rule evaluation differs between the two boundary controls since they operate on different boundary types. Security Group rule evaluation is unordered because it is stateful, and consequently, there are no explicit deny rules. Hence, if traffic matches any allow rule it is permitted, and a deny rule is implicit by the absence of allow rules for certain traffic. In contrast, NACLs have both deny and allow rules that may overlap, necessitating ordered evaluation. Hence, NACL rule evaluation is first-match wins, and NACLs typically have the last rule as deny-all. Security Groups and NACLs are also framed as flow-state awareness versus packet inspection. Subsequently, they also differ in their rule-management complexity.

Security Group Primary Use

Security Groups extend segmentation to the workload-level, thereby limiting the exposure of workloads or individual AWS resources. This ensures that traffic enforcement to individual AWS resources or micro segments is through the principle of least privilege. Traffic must be explicitly allowed by Security Groups to access workloads. Security Groups express trust for each tier, limiting exposure to explicitly trusted entities. This is further enhanced by Security Group-to-Security Group referencing, which simplifies trust evaluation. The control provided by Security Groups is flow-based stateful control, simplifying rule evaluation. It is also granular, providing per-resource isolation.

NACL Appropriate Use

Although Security Groups provide fine-grained boundary enforcement, there is a role for NACLs to provide subnet-level guardrail enforcement. NACLs act as a backstop whenever Security Groups are misconfigured, a rule is overly permissive, or a resource is assigned the wrong Security Group. Subsequently, explicit deny rules are necessary due to boundary control errors at the resource level. These rules are applied across the broad CIDR range, blocking any gaps in Security Group coverage. Therefore, NACLs provide compliance-driven boundary control and act as an additional defense-in-depth layer.

When NACLs Actually Make Sense

AWS Security Groups vs NACLs are often framed as a choice, but they are complementary layers of protection. Their relationship is best understood as individual buildings within a compound. Security Groups act as the security systems for each building, but NACLs form the perimeter wall around the compound, providing defense-in-depth.

Explicit Deny Requirements

Where AWS Security Groups vs NACLs is actually a choice is that Security Groups have Allow-only rules, which is one of their limitations. While security architecture is based upon explicit trust, there are many use cases when explicit distrust or blacklists are required. The most common use case is blocking CIDR ranges associated with known malicious actors from security intelligence. Therefore, it is imperative to prevent these specific IP classes at subnet boundaries to provide defense-in-depth against these actors. Furthermore, there are often regulatory mandates for explicit denial semantics of known threats. These hard stop controls act independently of workload policies.

Subnet-Level Guardrails Against Misconfiguration

Another consideration where the AWS Security Groups vs NACL framing is applicable is that Security Groups can be overly permissive. Additionally, it is possible to incorrectly attach Security Groups to the wrong resource, reducing their protection and making them vulnerable. Since Security Groups are code, they can contain bugs that result from human error, affecting containment and increasing exposure. Therefore, NACLs provide subnet-wide maximum exposure limits, preventing exposure due to misconfigurations. This also ensures uniform enforcement of exposure limits across all subnet resources, enabling defense-in-depth beyond workload policies.

Compliance and Regulatory Isolation

Cloud environments are often deployed in heavily regulated industries such as finance and health. NACLs meet regulatory requirements by demonstrating subnet-level boundary enforcement. Additionally, they provide a clear separation of public and private tiers that are often subject to regulatory scrutiny, with private tiers limiting exposure of critical resources. Therefore, they provide structural isolation for these sensitive workloads, which are often mandated by regulatory bodies. This also extends to regulatory-mandated explicit deny requirements for sensitive workloads. Furthermore, NACLs also enforce audit-friendly policy controls, making them a valuable layer of security architectures.

Emergency Containment and Broad Traffic Suppression

Diagram illustrating AWS Security Groups vs NACL emergency containment scenario with subnet-level traffic suppression

Stateful Security Groups can cause established connections to persist even after they are removed from the allow lists. NACLs can rapidly shut down subnet-level traffic once a threat is identified to prevent further compromise. They also provide immediate CIDR-wide blocking capability to allow a quick response to multiple IP addresses identified as threats. Therefore, they can provide a temporary exposure freeze to sensitive resources during an incident response. By providing broad ingress and egress suppression, NACLs can rapidly contain compromised workload zones.

Security Groups vs NACL: AWS VPC Segmentation Patterns

Where Security Groups vs NACLs is enforcement, but depends upon segmentation, otherwise, they become a firewall sprawl. Therefore, segmentation comes before establishing Security Groups and NACLs, thereby reducing rule complexity. Segmentation is covered in depth in Architecture is the First Security Control in AWS. The key segmentation strategies simplifying Security Groups and NACLs are considered here.

Prod / Non-Prod Separation

Organizations universally implement CI/CD pipelines with both production and non-production environments. Therefore, best practices recommend having separate VPCs for these environments. Implementing separate VPCs for these environments limits the blast radius of any security incident within them, preventing it from spreading to the other environment. Furthermore, given the criticality of production environments, the Security Groups and NACLs should have stricter ingress and egress controls. Additionally, implementing VPCs significantly reduces the lateral movement from dev and test tiers. Furthermore, boundary separation aligns with risk across development, testing, and production. Also, implementing VPCs ensures controlled routing paths between these environments.

Shared Services VPC

Different environments often share common requirements, and it is essential to support these requirements while enforcing segmentation between these environments. Architectures must incorporate centralized logging and monitoring services, which are core to managing any system while still keeping environments isolated. This also includes directory and integrity integration components that support authentication and authorization for AWS resources. Additionally, CI/CD and automation tooling are essential for software maintenance, but still must remain segregated from other environments. Therefore, these services occupy a special segment called shared services VPC and are isolated from workload VPCs. The Shared Services VPC establishes an explicit trust domain definition for these shared services and minimizes lateral access into them.

Central Inspection VPC

Diagram showing a central inspection VPC pattern with multiple workload VPCs connected through a transit gateway to an inspection VPC using IDS, IPS, and egress filtering

Workload segmentation is a key architectural principle, but when VPCs can easily communicate with each other, that begins to disintegrate. This is particularly true whenever VPCs can communicate with the outside world or the external environment. Therefore, it is recommended to consolidate this communication, allowing traffic inspection and enforcement into a single centralized filtering layer. This is supported by Transit Gateway traffic routing control that routes all external VPC traffic through the inspection VPC. This allows the inspection VPC to implement Intrusion Detection Systems (IDS) for monitoring and Intrusion Prevention Systems (IPS) for active blocking of malicious traffic. It also inspects outbound internet traffic for malicious behaviour. Furthermore, it enforces consistent policies across the VPCs and supports standardized logging and monitoring aggregation.

Multi-Account vs Single-Account Thinking

Whereas VPCs isolate network traffic, accounts are the next boundary level above that establishes macro trust boundaries. Accounts, therefore, isolate identity, permissions, control plane, and resource ownership. They also provide more extensive isolation of production and non-production accounts, where production accounts have tighter controls. Furthermore, accounts in AWS provide the Service Control Policy enforcement layer that establishes guardrails for entity behavior within the account. Accounts establish independent identity and permission domains, so that roles and users in one account cannot access another without explicit cross-account trust. This reduces the blast radius where compromised credentials within one account are unable to access resources in another account. Additionally, it enforces stronger least privilege by scoping permissions to a smaller resource domain. Also, since teams control only their account’s identity and policies, it establishes clear ownership and accountability.

Traffic Flow Thinking > Rule Lists

Data Flow Modeling

Securing AWS resources is based on the flow of data traffic between them and entities external to the AWS environment. This also has implications for AWS Security Groups vs NACLs for regulating traffic flow. The first step is always to identify the source and destination of any data flow and how to regulate it. From there, modeling maps communication between tiers to determine how control traffic flow. This further leads to analyzing the justification for the existence of different protocols and ports across boundaries based on traffic-flow modelling. This also includes selecting legitimate vs unnecessary path analysis, along with ingress and egress flow definition. Ultimately, traffic flow must align with business function and associated use cases.

Trust Boundaries Drive Enforcement

Traffic flow modelling is based upon trust boundaries between AWS resources, with the VPC as the macro trust boundary below AWS Accounts. Below the VPC, the subnet serves as the exposure boundary, controlled by NACLs, providing defense-in-depth for workloads. The workloads are the individual resources that are controlled by the AWS Security Groups, hence Security Groups vs NACLs. However, it is the definition of these boundaries that precedes restriction, and their rules further refine these restrictions. They act to prevent unintended lateral movement through structural design.

Intent-Based Security Design

With this design framework in place, there are several guidelines for designing secure environments. This begins with defining the business purposes of the workloads and then aligning the communication paths with the application intent. Upon definition of data sensitivity, establish access to data with the appropriate risk level. When defining access, avoid opening ports because they are available but only when communication is required. Also, instead of defining how communication is technically allowed, define who is allowed to communicate. This helps to minimize exception-based rule growth.

Conclusion: AWS Security Groups vs NACLs

From considering security first architecture, AWS Security Groups vs NACL is not a debate about which tools are better, but about architectural layering. Here, the emphasis is on structure before any enforcement decisions are taken. Hence, consider VPC first, then subnets, after that, routing, and then controls. Following this approach ensures that traffic flow modelling and the establishment of trust boundaries are the starting point for any security posture. This results in controls refining the architecture rather than compensating for poor segmentation. Additionally, this approach leads to defense-in-depth as an intentional design instead of rule accumulation.

Architecture and network design subsequently serve as the base layer for AWS Security and securing environments. This is clearly shown in segmentation and enforcement that form the basis of infrastructure security by isolating workloads from each other. By building identity, logging, and monitoring on these boundaries reduces their complexity, essential for any secure modern environment. From this, we can further consider the subsequent layers of the security pyramid.

AWS Security Groups vs NACLs: Further Reading

Security Pillar – AWS Well-Architected Framework

Organizing Your AWS Environment Using Multiple Accounts

Building a Scalable and Secure Multi-VPC AWS Network Infrastructure

Scroll to Top
Verified by MonsterInsights