AWS · Networking and Content Delivery

Amazon VPC

A logically isolated virtual network in AWS where you define IP ranges, subnets, routing and traffic filtering for your resources.

On the SAA-C03 exam listPrivate connectivityNetwork segmentation

What it is and what problem it solves

A Virtual Private Cloud (VPC) is your own private network inside an AWS Region. You choose its IP address range (a CIDR block), split it into subnets that each live in one Availability Zone, and control traffic with route tables, security groups and network ACLs. Almost every AWS resource that has a network address, such as an EC2 instance, a database or a load balancer, lives in a VPC.

A subnet is public when its route table sends internet traffic to an internet gateway, and private when it does not. Private subnets reach the internet through a NAT gateway, and reach AWS services privately through VPC endpoints.

Internet gatewayVPC 10.0.0.0/16AZ aPublic subnet 10.0.0.0/24NAT gateway+ Elastic IPALB nodePrivate subnet 10.0.10.0/24App instanceRDSprimary / standbyAZ bPublic subnet 10.0.1.0/24NAT gateway+ Elastic IPALB nodePrivate subnet 10.0.11.0/24App instanceRDSstandby / primaryroute 0.0.0.0/0 → IGW (public route table)
A two-AZ VPC: public subnets route to the internet gateway; private subnets reach out through a NAT gateway in their own AZ

When to use it

  • You run anything on AWS that needs an IP address. There is no "no VPC" option; a new account starts with a default VPC.
  • You want tiers separated: load balancers in public subnets, application servers and databases in private ones.
  • You need to control exactly which ranges can talk to each other, and over which ports.
  • You want a private path to other networks: other VPCs (peering or Transit Gateway), a data centre (VPN or Direct Connect), or AWS services (endpoints).

When to avoid it

  • Do not stretch one VPC across many unrelated workloads or teams. Separate VPCs (often in separate accounts) limit the blast radius of a mistake and make ownership clear.
  • Do not pick a small or overlapping CIDR range casually. A VPC's primary range cannot be changed later, and overlapping ranges block peering and Transit Gateway routing between networks. Plan ranges across the whole organisation first.
  • Do not rely on the default VPC for production. Its subnets are public by default.

Scaling model and bottlenecks

A VPC itself is not a capacity you scale; limits matter instead. Plan for how many IP addresses each subnet needs (AWS reserves five in every subnet), how many subnets you will add, and how many security group rules a resource needs. Running out of addresses in a subnet is a common production incident, and the fix is adding a subnet or a secondary CIDR block, not resizing the subnet.

A NAT gateway is zonal: put one in each Availability Zone you use, so an AZ outage does not cut off the other zones' outbound traffic.

Performance, latency and throughput

Traffic inside a VPC stays on the AWS network, and traffic between Availability Zones adds a little latency compared with traffic inside one zone. The data path for a NAT gateway, a load balancer or a Transit Gateway is managed, so latency and throughput there depend on the service rather than on your instances.

Limits and quotas

Most VPC limits are quotas you can raise. Several interact: the number of security groups per network interface multiplied by the rules per security group cannot exceed a fixed total, so raising one may mean lowering the other.

ItemValueContextSource
VPCs per Region 5
Can be raised with a quota request

Raising it also raises the internet gateway quota by the same amount.
Source
checked
Subnets per VPC 200
Can be raised with a quota request
Source
checked
IPv4 CIDR blocks per VPC 5
Can be raised with a quota request
The primary block and every secondary block count; can be raised to 50. Source
checked
Security groups per network interface 5
Can be raised with a quota request
Can be raised to 16. This number multiplied by the rules per security group cannot exceed 1,000. Source
checked
Rules per security group 60 inbound and 60 outbound
Can be raised with a quota request
Counted separately for inbound and outbound, and separately for IPv4 and IPv6. Source
checked
Network ACLs per VPC 200
Can be raised with a quota request
Source
checked
NAT gateways per Availability Zone 5
Can be raised with a quota request
Only gateways in the pending, active and deleting states count. Source
checked
Elastic IP addresses per Region 5
Can be raised with a quota request
Source
checked
Routes per route table 500
Can be raised with a quota request
Non-propagated routes; can be raised to 1,000. Propagated routes are capped at 100 and that cap is fixed. Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Cost model

What you pay for

A VPC, subnets, route tables, security groups and network ACLs are free. You pay for things you attach to it:

  • NAT gateways: an hourly charge for each gateway, plus a per-GB charge for all data it processes.
  • Public IPv4 addresses: an hourly charge for each address, whether it is in use or idle.
  • Data transfer: traffic that crosses Availability Zones, leaves a Region or goes to the internet is billed per GB.
  • VPC peering traffic that crosses Availability Zones in the same Region is billed per GB in both directions.
  • Optional features such as Traffic Mirroring, Reachability Analyzer and interface endpoints are billed separately.

Where it is cost-efficient

A network with mostly private traffic inside one Availability Zone, using gateway endpoints for S3 and DynamoDB, costs very little beyond the resources in it.

Where costs grow

  • Large volumes of traffic from private subnets to S3, DynamoDB or other AWS services through a NAT gateway, because every GB is processed and billed.
  • Chatty services spread across Availability Zones.
  • A NAT gateway in every zone for a development environment that does not need high availability.
  • Many public IPv4 addresses that are not needed.

Cost controls and common surprises

Use gateway endpoints for S3 and DynamoDB (no hourly or per-GB charge), keep chatty tiers in the same zone where availability allows, release unused Elastic IPs, and review NAT gateway data processing in Cost Explorer. The most common surprise is a NAT gateway bill driven by S3 traffic.

Prices differ by Region and change over time; see the pricing page linked under Sources.

Security

Controls the service provides

  • Isolation: a VPC is private to your account unless you connect it somewhere.
  • Security groups: stateful filters attached to network interfaces; allow rules only.
  • Network ACLs: stateless filters on subnets; allow and deny rules, evaluated in order.
  • Private connectivity options: VPC endpoints and PrivateLink, so traffic to AWS services need not cross the internet.

What you configure

You decide which subnets are public, which routes exist, which ports security groups open, and who may change any of it through IAM. Keep databases and application servers in private subnets, open security groups to specific groups rather than wide ranges, and avoid 0.0.0.0/0 on administrative ports.

Logging and monitoring

VPC Flow Logs record accepted and rejected traffic for a VPC, subnet or network interface and can go to CloudWatch Logs, S3 or Firehose. CloudTrail records changes to network configuration.

Related security services

AWS Network Firewall, AWS WAF, AWS Shield, Security Hub and Firewall Manager add inspection and policy on top of VPC networking.

Shared responsibility

AWS secures the underlying network. You configure subnets, routes, security groups, network ACLs and endpoints, and you are responsible for what they allow.

Availability, backup and failure behavior

A VPC spans every Availability Zone in its Region, but each subnet lives in exactly one zone. Spread resources over subnets in at least two zones to survive a zone failure. Gateways that are zonal, such as NAT gateways, need one per zone. The VPC's route tables, security groups and network ACLs are regional configuration and are not backed up for you; define them as infrastructure as code.

Common service combinations

EC2 and Auto Scaling in private subnets behind an Application Load Balancer in public subnets; RDS or Aurora in private database subnets; S3 and DynamoDB reached through gateway endpoints; other VPCs and data centres joined through peering, Transit Gateway, Site-to-Site VPN or Direct Connect.

Business application examples

  • A web shop with public load balancers, private application servers and a private database, in two zones.
  • A shared-services VPC (logging, directory, build tools) that many application VPCs reach through Transit Gateway.
  • A data platform where jobs in private subnets read S3 through a gateway endpoint to avoid NAT charges.

Exam cues and common confusions

  • Public vs private subnet: the difference is the route to an internet gateway, not a setting on the subnet.
  • Outbound-only internet from private subnets means a NAT gateway (in a public subnet), not an internet gateway.
  • Security group vs network ACL: stateful and allow-only vs stateless with deny rules. "Block one IP address" is a network ACL.
  • Private access to S3 or DynamoDB with no internet path is a gateway endpoint; for most other AWS services it is an interface endpoint (PrivateLink).
  • A NAT gateway is zonal; for high availability use one per zone.

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services. AWS and service names are trademarks of Amazon.com, Inc. or its affiliates.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake