AWS Builder Center
Architecting Zero-Trust Microsegmentation with AWS Security Groups and Network ACLs

Architecting Zero-Trust Microsegmentation with AWS Security Groups and Network ACLs

In a traditional perimeter-based security model, once traffic passes the outer firewall, internal workloads can freely communicate. Modern cloud security demands a Zero-Trust Network Architecture, where every network flow within your Virtual Private Cloud (VPC) is explicitly evaluated, authenticated, and authorized based on strict least-privilege principles.

Building resilient cloud architectures, SOC threat detection workflows, & secure networks.

The Dual-Layer Defense Strategy

AWS provides two distinct firewalls within VPC infrastructure. Combining stateless stateless subnets filtering with stateful instance filtering delivers granular control.
Feature
Network ACL (NACL)
Security Group (SG)
Operating Layer
Subnet boundary
ENI / Instance level
State Tracking
Stateless (Must explicitly allow inbound & outbound responses)
Stateful (Return traffic automatically allowed)
Evaluation Order
Evaluated in numerical rule order (lowest first)
Evaluated all rules before allowing traffic
Supported Actions
ALLOW and DENY
ALLOW only (Implicit deny all)

Core Architecture Design

A resilient 3-tier microsegmented VPC isolates components into independent subnet groups:
  1. Public/Ingress Tier: Houses Application Load Balancers (ALBs) exposed to external users via Amazon CloudFront and AWS WAF.
  1. Application Tier: Houses private compute workloads (AWS Lambda in VPC, Amazon ECS, or Amazon EC2) restricted strictly to traffic coming from the ALB Security Group.
  1. Database Tier: Contains persistent storage (Amazon Aurora or Amazon DynamoDB VPC Endpoints) that only accepts incoming connections from the Application Tier Security Group on port 5432 / 3306.

Infrastructure as Code Setup (AWS SAM / CloudFormation)

The declarative example below demonstrates how to reference Security Groups by ID rather than IP CIDR blocks, establishing strict tier-to-tier isolation:
YAML
AWSTemplateFormatVersion: '2010-09-09'
Description: Zero-Trust Microsegmented Security Group Configuration

Resources:
# 1. Application Load Balancer Security Group
ALBSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Public HTTP/HTTPS Ingress
VpcId: !Ref VPCID
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 0.0.0.0/0

# 2. Application Tier Security Group (Only accepts traffic from ALB SG)
AppTierSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Private App Compute Tier
VpcId: !Ref VPCID
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 8080
ToPort: 8080
SourceSecurityGroupId: !Ref ALBSecurityGroup

# 3. Database Tier Security Group (Only accepts traffic from App Tier SG)
DatabaseSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Isolated Database Tier
VpcId: !Ref VPCID
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 5432
ToPort: 5432
SourceSecurityGroupId: !Ref AppTierSecurityGroup

Implementation Best Practices

  • Reference Security Group IDs Instead of CIDRs: Avoid hardcoding internal IP ranges. Pointing Security Group rules directly to other Security Group IDs ensures auto-scaling instances automatically inherit the correct ingress permissions.
  • Enable VPC Flow Logs: Capture and stream network log data to Amazon CloudWatch Logs or Amazon S3 to audit rejected traffic attempts ( REJECT ) and identify misconfigured firewall rules.
  • Remember Ephemeral Ports for NACLs: Because NACLs are stateless, return traffic requires allowing ephemeral ports (typically  1024–65535 ) on outbound NACL rules for established connections to complete.

Conclusion

Microsegmentation eliminates lateral movement vectors within your cloud infrastructure. By enforcing strict security group references between application tiers and wrapping subnets in baseline stateless NACLs, you achieve a verified Zero-Trust posture on AWS.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article