AWS VPC explained in plain terms: a Virtual Private Cloud is a logically isolated section of the AWS cloud where you launch resources in a virtual network you define. You choose the IP address range, divide it into subnets, decide how traffic flows between them and the internet, and control who can reach what. The short answer is that a VPC is your own private network inside AWS, and almost everything you run, from EC2 instances to databases, lives inside one.
Every AWS account comes with a default VPC in each region, so you can launch resources without designing a network first. That default VPC works for learning, but production workloads deserve a VPC designed deliberately, with separate subnets for public and private resources and clear rules about what can talk to the internet. Our guide to cloud networking explained covers the general concepts this article applies to AWS.
Key takeaways
- An AWS VPC is a logically isolated virtual network in one region, spanning all of its Availability Zones.
- Subnets divide the VPC address range; public subnets have a route to an internet gateway, private subnets do not.
- Route tables decide where traffic goes, and each subnet is associated with exactly one route table.
- Security groups are stateful instance-level firewalls, while network ACLs are stateless subnet-level firewalls.
- A NAT gateway lets private resources reach the internet outbound without being reachable inbound, and VPC endpoints let them reach AWS services without the internet at all.
What a VPC actually is
A VPC is regional: it spans all the Availability Zones in one region, and resources in different zones can talk to each other over the VPC’s internal network. You create a VPC by choosing a CIDR block, an IP address range such as 10.0.0.0/16, which gives you 65,536 addresses to divide among your subnets. The block must come from the private address ranges, and once chosen, the primary block cannot be changed, though secondary blocks can be added.
By default, an account can have five VPCs per region, though that quota can be raised. Each region also comes with one default VPC, with the range 172.31.0.0/16 and a subnet in each Availability Zone, all of them public. Best for: one VPC per environment or application, with a CIDR range large enough to grow.
Subnets: public, private and isolated
A subnet is a range of IP addresses within your VPC, and every resource you launch sits inside one. Each subnet belongs to exactly one Availability Zone, so high availability means placing resources in subnets across at least two zones. What makes a subnet public is its route table: a route to an internet gateway makes it public, and without one it is private.
An isolated subnet has no route to the internet gateway or to a NAT gateway, so it is cut off from internet traffic in both directions.
The standard pattern is two or three public subnets for load balancers and the few resources that must face the internet, and two or three private subnets for application servers and databases. Spreading each tier across Availability Zones means a zone failure takes out only part of the fleet, not the whole application. Best for: putting databases and application servers in private subnets, and only load balancers and bastion hosts in public ones.
Route tables and how traffic flows
Route tables decide where network traffic from a subnet is directed. Every subnet must be associated with a route table, either explicitly or through the VPC’s main route table, and each route table can hold up to 200 route tables per VPC. The most important route in a public subnet is 0.0.0.0/0 pointing at the internet gateway, which sends all internet-bound traffic out through it.
Private subnets usually route 0.0.0.0/0 to a NAT gateway instead, so their resources can reach the internet to download updates or call external APIs, without being reachable from it. Each Availability Zone should have its own NAT gateway, so a zone failure does not cut off outbound internet access for the other zones. Best for: keeping the main route table minimal and giving each subnet tier its own explicit route table.
Internet gateways and NAT gateways
An internet gateway is the component that connects your VPC to the public internet, in both directions. It is horizontally scaled and redundant, so it is not a bottleneck or a single point of failure, and you can attach only one to a VPC at a time. There is no charge for the gateway itself, though data transfer through it is billed.
A NAT gateway is different: it lets resources in a private subnet reach the internet outbound, without being reachable inbound. It is a managed service that AWS runs for you, it sits in a public subnet, and it is charged by the hour plus the data it processes. Because a NAT gateway lives in one Availability Zone, a private subnet in another zone that routes through it depends on that zone staying healthy, which is why the one-per-zone pattern matters.
Best for: one NAT gateway per Availability Zone in production, and none at all for subnets that never need the internet.

Security groups and network ACLs
Security groups and network ACLs are the two firewalls in a VPC, and they work at different layers. A security group is attached to a resource, such as an EC2 instance or a database, and it controls traffic in and out of that resource. Security groups are stateful, which means if you allow an inbound request, the reply is allowed back automatically, and they only contain allow rules: anything not allowed is denied.
A network ACL is attached to a subnet and controls traffic in and out of the whole subnet. Network ACLs are stateless, which means you must allow both the request and the reply explicitly, and they support both allow and deny rules, evaluated in number order. They are a coarse second layer of defence, useful for blocking a known bad address range at the subnet edge.
The practical rule is to do most of your filtering with security groups, because they follow the resource and are easier to reason about, and to keep network ACLs at their permissive defaults unless you have a specific reason to tighten them. Best for: security groups as the primary control, with network ACLs reserved for subnet-wide blocks.
VPC endpoints and Flow Logs
A VPC endpoint lets resources in your VPC reach an AWS service, such as S3 or DynamoDB, without going through the internet. Gateway endpoints work for S3 and DynamoDB and are free, while interface endpoints use PrivateLink and work for most other services, at an hourly charge. Endpoints keep traffic private and avoid NAT gateway data charges for service traffic, which is why they are popular in locked-down VPCs.
VPC Flow Logs record the network traffic going to and from your VPC, subnets and interfaces, and they are the first thing you reach for when a connection fails. They show which traffic was accepted and which was rejected, and they are stored in CloudWatch Logs or S3. Switching them on before an incident, rather than after, is the difference between a five-minute diagnosis and a day of guessing.
Best for: endpoints for S3 and DynamoDB in private subnets, and Flow Logs switched on in every production VPC.
| Component | What it does | Scope | Cost |
|---|---|---|---|
| VPC | Isolated virtual network you define | Regional | Free |
| Subnet | IP range within the VPC, tied to one zone | One Availability Zone | Free |
| Internet gateway | Connects the VPC to the internet, both ways | One per VPC | Free, data transfer billed |
| NAT gateway | Outbound-only internet access for private subnets | One Availability Zone | Hourly charge plus data processed |
| Security group | Stateful, allow-only firewall on a resource | Per resource | Free |
| Network ACL | Stateless firewall on a subnet, allow and deny | Per subnet | Free |
| VPC endpoint | Private access to AWS services, no internet | Per service | Gateway endpoints free, interface endpoints charged |
A practical VPC layout
A layout that serves most applications has one VPC per environment, with three Availability Zones. Each zone gets one public subnet and one private subnet, plus an isolated subnet for databases in the zones where they run. The public subnets host the load balancer, the private subnets host the application servers, and the isolated subnets host the database.
The route tables follow the tiers. Public subnets route 0.0.0.0/0 to the internet gateway. Private subnets route 0.0.0.0/0 to the NAT gateway in their own zone.
Isolated subnets have no default route at all. Security groups then enforce the tier boundaries: the database accepts traffic only from the application security group, and the application accepts traffic only from the load balancer security group. Our tutorial on building a VPC walks through the same layout step by step.
Best for: three zones, three tiers, and security groups that reference each other instead of IP ranges.
Decision checklist: designing a VPC
- Choose a CIDR block large enough for growth, such as a /16, and divide it into public, private and isolated subnets across at least two Availability Zones.
- Put only load balancers and bastion hosts in public subnets; application servers go in private subnets and databases in isolated ones.
- Give each subnet tier its own route table, and place one NAT gateway in each Availability Zone for outbound access.
- Use security groups as the primary firewall, referencing other security groups instead of IP ranges, and leave network ACLs permissive unless you need a subnet-wide block.
- Add VPC endpoints for S3 and DynamoDB so private resources reach those services without the internet or NAT charges.
- Switch on VPC Flow Logs in every production VPC so connectivity problems can be diagnosed from evidence, not guesses.
- Use VPC peering for a small number of connections and a transit gateway when many VPCs and on-premises networks need to connect.
Frequently asked questions
What is an AWS VPC in simple terms?
An AWS VPC, or Virtual Private Cloud, is a logically isolated virtual network inside AWS where you launch your resources. You define its IP address range, its subnets, its routing and its security rules, so your resources are separated from everyone else’s.
What is the difference between a public and a private subnet?
A public subnet has a route to an internet gateway, so resources in it can be reached from the internet and can be assigned public IP addresses. A private subnet has no such route, so its resources cannot be reached directly from the internet, though they can reach out through a NAT gateway.
What does a NAT gateway do?
A NAT gateway lets resources in a private subnet reach the internet outbound, for example to download updates, without being reachable inbound. It is a managed service that sits in a public subnet, and you should place one in each Availability Zone for resilience.
What is the difference between a security group and a network ACL?
A security group is a stateful, allow-only firewall attached to a resource, while a network ACL is a stateless firewall attached to a subnet that supports both allow and deny rules. Security groups are the primary control in practice, and network ACLs provide a second, coarser layer.
How many VPCs can I have per region?
By default, five VPCs per region, though that quota can be raised through a service quota request. Each region also comes with one default VPC, with the range 172.31.0.0/16.
Do I need a VPC to use AWS?
Most services run inside a VPC, and every account has a default VPC in each region, so you can start without designing one. For production workloads, a VPC designed deliberately, with public, private and isolated subnets, is the standard approach.







