AWS VPC Security Architecture Guide
AWS VPC security architecture: subnet tiers, security groups and NACLs, private access to AWS services, egress control, flow logs and a reference design.
VPC security is the practice of designing an AWS virtual network so that every workload is reachable only by what needs it, and everything entering or leaving is controlled and logged. It rests on a few decisions: how subnets are routed, how security groups and network ACLs filter traffic, how workloads reach AWS services, how outbound traffic is restricted, and what you record.
This guide covers each decision in turn and ends with a reference design and a checklist. The controls inside the network are explained in detail in our comparison of security groups vs NACLs, and the instances themselves in our guide to EC2 hardening.
What are the building blocks of VPC security?
| Building block | Its job | The security decision |
|---|---|---|
| Subnets and route tables | Decide what can reach the internet and how | Which tier gets a route to an internet gateway, a NAT device, or nothing |
| Security groups | Stateful allow rules per resource | Which sources may reach each workload, on which ports |
| Network ACLs | Stateless allow and deny rules per subnet | Coarse guardrails and explicit denies |
| VPC endpoints | Private paths to AWS services | Whether traffic to services leaves for the internet at all |
| NAT and egress filtering | Controlled outbound access | Which destinations private workloads may call |
| Flow logs | Records of IP traffic | What you can investigate after the fact |
How should you lay out subnets?
In AWS, a subnet's type is set by its routing. The subnet documentation defines four main types:
- Public subnet: has a direct route to an internet gateway
- Private subnet: has no direct route to an internet gateway and needs a NAT device to reach the internet
- VPN-only subnet: routes to a Site-to-Site VPN connection, not to an internet gateway
- Isolated subnet: has no routes outside the VPC at all
Each subnet sits entirely in one Availability Zone, so every tier needs a subnet in each zone you use. A secure default is three tiers: public subnets that hold only load balancers and NAT gateways, private subnets for application workloads, and isolated subnets for databases and anything that should never talk to the internet.
The test is simple: for each workload, can you explain why its subnet has the route it has? If a database sits in a public subnet "for now", that is the first finding.
How do security groups and NACLs fit into the design?
Security groups do the fine-grained work. Give each tier its own group and reference groups instead of IP ranges: the application group allows traffic from the load balancer group, and the database group allows traffic only from the application group.
Network ACLs add subnet-level guardrails, such as denying a known-bad range or keeping the isolated tier closed to the public subnets even if a security group is misconfigured. Remember that NACLs are stateless and cannot block some AWS link-local services, such as instance metadata and Amazon DNS.
How do workloads reach AWS services privately?
Through VPC endpoints. AWS PrivateLink lets clients in your VPC connect to services using private IP addresses, and the PrivateLink documentation states that traffic between a VPC endpoint and the endpoint service stays within the AWS network, without traversing the public internet. For Amazon S3 and DynamoDB, gateway endpoints add a route instead and do not use PrivateLink.
Endpoints also give you a control point. A VPC endpoint policy is an IAM resource policy attached to the endpoint, and the default one allows all actions by all principals on all resources. Replace it with a policy that allows only the buckets, tables or actions your workloads use. That turns the endpoint from a convenience into a data-exfiltration control.
How do you control outbound traffic?
A NAT gateway gives private subnets a way out to the internet, which most workloads need for updates or third-party APIs. It does not decide where they may go.
Restrict egress in layers. Tighten security group outbound rules so each workload can reach only the ports and destinations it uses. Route traffic through an egress filter, such as a managed network firewall or a proxy, when you need to allow by domain name. Give isolated subnets no route out at all. Egress is where a compromised workload sends data, so an unrestricted path out is the gap attackers count on.
How do you see what happens in the VPC?
Turn on VPC Flow Logs. They capture information about the IP traffic going to and from network interfaces in your VPC and can be published to CloudWatch Logs, Amazon S3 or Data Firehose. AWS notes that flow log data is collected outside the path of your traffic, so it does not affect network throughput or latency.
Use them for what AWS lists: diagnosing overly restrictive security group rules, monitoring the traffic reaching your instances, and determining the direction of traffic. In an incident, they are often the only record of which internal systems a compromised instance talked to.
How do you scale VPC security across accounts?
Separate environments and teams with accounts and VPCs, not with security group rules alone. Production, staging and development should not share a VPC. Centralize the controls that benefit from one place, such as egress filtering, inspection and logging, and keep connectivity between VPCs explicit and minimal instead of connecting everything to everything.
Write the design down as code. A VPC built by hand drifts within weeks; one built from templates can be reviewed before it changes.
A reference VPC security design
| Tier | Subnet type | Routes | Inbound allowed | Outbound allowed |
|---|---|---|---|---|
| Edge | Public, one per Availability Zone | Internet gateway | 443 to the load balancer only | To the application tier |
| Application | Private, one per Availability Zone | NAT gateway; VPC endpoints | From the load balancer security group | To the data tier, endpoints and approved destinations via egress filter |
| Data | Isolated, one per Availability Zone | Local VPC only; gateway endpoints if needed | From the application security group only | Nothing beyond the VPC |
| Management | Private | VPC endpoints for Systems Manager | None from the internet | To AWS services through endpoints |
Every arrow in this design is either a security group reference or a route you chose deliberately. If you cannot point to the rule that allows a flow, the flow should not exist.
VPC security best practices checklist
- Every subnet's route table matches its intended tier
- No databases or internal services in public subnets
- One security group per tier, referencing other groups instead of IP ranges
- No security group allows 0.0.0.0/0 except on intended public ports
- VPC endpoints for the AWS services you use, with restrictive endpoint policies
- Outbound traffic restricted per workload, isolated subnets with no route out
- Flow logs enabled and sent to a central logging account
- Production, staging and development in separate accounts and VPCs
What are the most common VPC security mistakes?
- Using the default VPC for real workloads, with public subnets and routing nobody designed.
- One flat subnet tier where web servers, applications and databases share routes and reachability.
- Unrestricted egress through the NAT gateway, so any compromised workload can send data anywhere.
- Endpoints with the default allow-all policy, which keeps traffic private but does not limit what it can reach.
- Flow logs switched off, or kept only in the account an attacker would compromise first.
Each of these is easy to fix early and expensive to fix once dozens of workloads depend on the current layout.
How do you keep the design from drifting?
Review the network after every significant change and monitor between reviews. ResilientX cloud security posture monitoring connects agentlessly to AWS, Azure and GCP through their APIs, scans resources in every Region, and flags open ports, misconfigured firewalls, risky IAM policies and public storage, with CIS AWS Foundations scoring. External attack surface management confirms what is actually reachable from the internet, and both feed one view of exposure management. Assess your cloud security posture with ResilientX UEM to check your VPCs against this design.
Frequently asked questions
Is a private subnet secure on its own?
No. A private subnet only means there is no direct route from an internet gateway. Instances inside can still be reached from other subnets, can still reach the internet through a NAT device, and can still be compromised through an application flaw. Security groups, egress control and instance hardening do the rest of the work.
Do I need a network firewall in my VPC?
Not always. Security groups and NACLs filter by address and port, which covers most workloads. A managed network firewall or proxy earns its place when you need to filter outbound traffic by domain, inspect traffic between VPCs, or meet a requirement for centralized inspection. Decide based on the egress policy you want to enforce.
Should development and production share a VPC?
No. Sharing a VPC makes the separation depend entirely on security group rules, and one permissive rule connects the two. Separate accounts and VPCs make the boundary structural, simplify access control, and let development teams experiment without touching production routing. Connect them only where a specific flow is needed.
The short version
Route by tier, filter with security groups that reference each other, add NACLs as guardrails, reach AWS services through endpoints with real policies, restrict egress, and log flows centrally. Then watch for drift, because the design is only as good as the last change.
Assess your cloud security posture with ResilientX UEM — book a demo and see your VPCs, security groups and exposures in one view.