AWS Builder Center

Amazon VPC: Understanding Networking in AWS

Learn how Amazon VPC provides a secure and isolated network environment for AWS resources, including subnets, route tables, internet gateways, and security controls.

Amazon VPC: Understanding Networking in AWS

When applications run in the AWS Cloud, they need a network through which resources can communicate securely. Amazon Virtual Private Cloud (Amazon VPC) allows you to create and manage your own virtual network inside AWS.
Whether you are running an EC2 instance, hosting a web application, or connecting different AWS services, understanding VPC is an important part of learning AWS networking.

What is Amazon VPC?

Amazon VPC (Virtual Private Cloud) is a logically isolated virtual network that you define within AWS.
A VPC gives you control over important networking components such as:
  • IP addresses
  • Subnets
  • Route tables
  • Internet gateways
  • Network security
You can think of a VPC as your own private network in the AWS Cloud.

Why is VPC Important?

Without proper networking, cloud resources would not be able to communicate in a controlled and secure way.
Amazon VPC allows you to decide:
  • Which resources can communicate with each other
  • Which resources can access the internet
  • Which resources should remain private
  • How network traffic should be routed
  • How access to resources should be controlled
This makes VPC an important foundation for building secure cloud architectures.

VPC and EC2

Amazon VPC and Amazon EC2 work closely together.
When you launch an EC2 instance, it is placed inside a VPC and a subnet.
For example:
VPC → Subnet → EC2 Instance
The VPC provides the network environment, while the EC2 instance provides the computing capacity.

What is a Subnet?

A subnet is a range of IP addresses within a VPC.
Subnets allow you to divide a VPC into smaller network sections.
There are commonly two types of subnets:

Public Subnet

A public subnet can contain resources that need access to or from the internet, depending on its routing and security configuration.
For example, a public-facing web server may be placed in a public subnet.

Private Subnet

A private subnet is typically used for resources that should not be directly accessible from the public internet.
For example, application servers and databases can be placed in private subnets.
A simple architecture can look like this:
Internet → Public Subnet → Web Server
Private Subnet → Application Server → Database

Internet Gateway

An Internet Gateway (IGW) is a VPC component that allows communication between resources in a VPC and the internet when the appropriate routing and public addressing are configured.
For example, an EC2 instance in a public subnet can use an Internet Gateway to communicate with the internet.
A route table associated with the subnet must contain an appropriate route for internet-bound traffic.

Route Tables

A route table contains rules that determine where network traffic should be sent.
For example, a route can specify that traffic destined for the internet should be sent through an Internet Gateway.
A simplified example is:
Destination: 0.0.0.0/0 → Target: Internet Gateway
This means traffic destined for any IPv4 address can be routed toward the Internet Gateway.

Security Groups

A security group acts as a virtual firewall for resources such as EC2 instances.
Security groups control network traffic at the resource level.
For example, you could allow:
  • HTTP traffic on port 80
  • HTTPS traffic on port 443
  • SSH traffic on port 22
Only the required traffic should be allowed to reduce unnecessary exposure.

Network ACLs

A Network Access Control List (Network ACL) provides another layer of network traffic control.
Unlike security groups, which operate at the resource level, network ACLs operate at the subnet level.
This allows you to control traffic entering or leaving a subnet.
Security groups and network ACLs can therefore work together as different layers of network security.

Public and Private Architecture

A common AWS architecture separates public-facing and internal resources.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
Internet
|
Internet Gateway
|
Public Subnet
|
Web Server
|
Private Subnet
|
Application Server
|
Database
This design helps keep internal resources away from direct internet access while allowing public-facing components to serve users.

VPC IP Addressing

Every VPC is assigned an IPv4 CIDR block that defines its IP address range.
For example:
10.0.0.0/16
Subnets can then use smaller ranges from this address space.
For example:
  • VPC: 10.0.0.0/16
  • Public subnet: 10.0.1.0/24
  • Private subnet: 10.0.2.0/24
Planning IP address ranges properly becomes increasingly important as cloud environments grow.

NAT Gateway

Resources in a private subnet may sometimes need to access the internet for tasks such as downloading software updates.
A NAT Gateway can allow resources in a private subnet to make outbound connections to the internet without allowing unsolicited inbound internet connections to those resources.
A common architecture is:
Private Subnet → NAT Gateway → Internet Gateway → Internet
The NAT Gateway is generally placed in a public subnet.

VPC Peering

Sometimes applications need resources in different VPCs to communicate.
VPC Peering can establish a network connection between two VPCs.
This allows resources in the connected VPCs to communicate using private IP addresses, subject to routing and security configuration.

VPC Use Cases

Amazon VPC is commonly used for:
  • Hosting web applications
  • Creating secure application environments
  • Separating public and private resources
  • Controlling network traffic
  • Connecting cloud resources
  • Building multi-tier applications
  • Creating hybrid cloud architectures

Key VPC Components

The most important VPC concepts to remember are:
ComponentPurpose
VPCProvides the virtual network
SubnetDivides the VPC into smaller networks
Route TableControls where network traffic goes
Internet GatewayEnables internet connectivity
NAT GatewayProvides outbound internet access for private resources
Security GroupControls traffic to resources
Network ACLControls traffic at the subnet level
VPC PeeringConnects two VPCs

Conclusion

Amazon VPC is one of the fundamental services for understanding AWS networking.
By learning VPC, you can understand how AWS resources communicate, how public and private networks are designed, and how network traffic is controlled.
A strong understanding of VPC, subnets, route tables, Internet Gateways, NAT Gateways, security groups, and network ACLs provides a solid foundation for learning more advanced AWS networking and cloud architecture.
If you are learning AWS step by step, understanding VPC after EC2 is a natural progression toward building real-world cloud applications.
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