
Understanding AWS VPC: A Practical Look at How Networking Works in AWS
Amazon VPC is the networking foundation behind many AWS workloads. This article explains how VPCs, subnets, routing, gateways, and security controls work together and why good network planning matters before deploying cloud resources.
Series: Modern Technology (5 articles)
- …
- 3Understanding AWS VPC: A Practical Look at How Networking Works in AWS This article
When people start learning AWS, they usually begin with services such as Amazon EC2, Amazon S3, or Amazon RDS. It does not take long, however, before networking becomes part of almost every deployment. An EC2 instance needs an IP address, a database needs controlled access, an application may need Internet connectivity, and private systems may need a secure path to other environments. Amazon Virtual Private Cloud, or Amazon VPC, is the service that provides this networking foundation.
A VPC can be thought of as a private network that we create inside AWS. Instead of AWS deciding how all of our resources should communicate, a VPC gives us control over the IP address range, subnet structure, routes, Internet access, and network security. This is important because two applications running in the same AWS account may still need completely different network designs.
One of the first decisions when creating a VPC is selecting its CIDR range. For example, we may choose
10.0.0.0/16 . That range becomes the address space available to the VPC. We can then divide it into smaller subnet ranges such as 10.0.1.0/24 , 10.0.2.0/24 , or 10.0.10.0/24 . This part may look simple when building a small lab, but IP planning becomes much more important when an organization starts connecting several VPCs, branch offices, data centers, or VPN environments.A common mistake is choosing IP ranges without thinking about future connectivity. Imagine that one VPC uses
10.0.0.0/16 and another environment later uses the same range. Both networks may work perfectly while they are separate, but connecting them becomes difficult because the same addresses exist on both sides. This is why VPC design should begin with address planning rather than with launching the first server.Subnets are used to divide the VPC into smaller network sections. Each subnet exists in a specific Availability Zone. This gives architects the ability to spread workloads across different zones rather than placing everything in one location. For example, one application server may run in an Availability Zone using subnet
10.0.10.0/24 , while another server can run in another zone using 10.0.20.0/24 .This becomes especially useful when designing highly available systems. If all application components are deployed into a single Availability Zone, an issue affecting that zone can have a larger impact. Creating subnets across multiple Availability Zones allows workloads such as load balancers, application servers, and databases to be distributed more safely.
Subnets are often described as public or private, although the subnet itself does not have a special "public" button. The difference mainly comes from routing. A subnet is generally considered public when its route table provides a path to an Internet Gateway. A private subnet normally does not have a direct route to that Internet Gateway.
An Internet Gateway connects a VPC to the Internet. Attaching one to the VPC alone is not enough to make every resource publicly accessible. The correct route must exist, and the resource may also require a public IP address and appropriate security rules. This is an important point because Internet connectivity in AWS depends on several components working together.
For example, a public subnet may contain a route that sends
0.0.0.0/0 traffic to an Internet Gateway. This means that traffic for destinations outside the VPC has a path toward the Internet. Even then, an EC2 instance will not necessarily accept incoming connections unless its Security Group permits them.Private subnets are useful for resources that should not receive direct Internet connections. Application servers, internal systems, and databases are common examples. A database often needs to communicate only with an application layer, so giving it direct Internet exposure adds risk without providing much benefit.
There are situations where a server inside a private subnet still needs to access the Internet. It may need to download updates, retrieve packages, or communicate with an external API. A NAT Gateway is commonly used in this situation. The private server sends its outbound traffic toward the NAT Gateway, which then provides a path to the Internet.
This creates an important difference. The private instance can start outbound connections, but Internet users cannot simply start new connections directly to the instance through the NAT Gateway. This is one reason NAT-based designs are commonly used for private application networks.
Routing is one of the areas that causes the most confusion during VPC troubleshooting. Every subnet is associated with a route table, and the route table decides where traffic should be sent. A route may point to an Internet Gateway, NAT Gateway, Transit Gateway, VPN connection, or another networking component.
One lesson that becomes clear when troubleshooting AWS networking is that allowing traffic and routing traffic are not the same thing. A Security Group may allow TCP port 443, but that permission does not create a network path. If the route is missing, the connection still fails. The opposite is also true. A perfect route does not help if the relevant security controls block the traffic.
Security Groups are one of the main network security mechanisms used in a VPC. They are attached to supported resources, usually through network interfaces, and they control allowed inbound and outbound communication. For example, an application server can be configured to accept connections only from a load balancer, while a database can be configured to accept connections only from the application servers.
Security Groups are stateful. If a permitted connection is established, the return traffic is automatically handled as part of that connection. This makes Security Groups easier to work with compared with stateless filtering mechanisms.
Network ACLs, usually called NACLs, operate differently. They work at the subnet boundary and are stateless. This means inbound and outbound rules must be considered separately. NACLs can also explicitly deny traffic, while Security Groups work by defining what is allowed.
For many environments, Security Groups provide the main workload-level security control, while NACLs can be used as another layer where there is a clear need for subnet-level filtering. Using both without understanding their roles can make troubleshooting unnecessarily complicated.
A typical application architecture might use several network layers. An Internet-facing Application Load Balancer can sit in public subnets. The application servers can remain in private subnets, while the database is placed in separate private database subnets. The public user communicates only with the load balancer, the load balancer communicates with the application servers, and the application servers communicate with the database.
This layered design is much safer than exposing every component directly to the Internet. It also allows Security Groups to be designed around application relationships instead of simply opening ports to large IP ranges.
As AWS environments grow, communication between VPCs also becomes important. VPC Peering is one way of providing private connectivity between two VPCs. If VPC A and VPC B are peered and the necessary routes and security rules are configured, resources can communicate using private addresses.
One limitation of VPC Peering is that it is not transitive. If VPC A is connected to VPC B and VPC B is connected to VPC C, that does not automatically create connectivity between VPC A and VPC C. This becomes important when designing networks containing many VPCs.
AWS Transit Gateway provides another approach for larger environments. Instead of creating a large number of individual connections between VPCs, several VPCs can connect to a central Transit Gateway. The architecture then looks more like a hub-and-spoke network.
Transit Gateway can also participate in hybrid connectivity designs. For example, multiple AWS VPCs may connect to the Transit Gateway while a Site-to-Site VPN provides connectivity to an organization's on-premises network. This is often easier to manage than building separate VPN or peering connections for every VPC.
AWS Site-to-Site VPN is useful when an organization needs encrypted connectivity between AWS and an external network such as an office, branch, or data center. The VPN uses IPsec tunnels, and routing can be configured depending on the environment. Dynamic routing with BGP is commonly used in more scalable designs.
For environments that need more dedicated connectivity, AWS Direct Connect is another option. Rather than using the public Internet as the underlying path, Direct Connect provides connectivity through a dedicated network connection. The correct choice between VPN, Direct Connect, or a combination of both depends on the organization's availability, performance, security, and cost requirements.
Another useful feature inside a VPC is the VPC Endpoint. A private workload does not always need to travel through a NAT Gateway or Internet path to access an AWS service. For supported services, a VPC Endpoint can provide a private connectivity path.
Amazon S3 is a good example. A private EC2 instance that needs access to an S3 bucket can use a VPC endpoint instead of sending that service traffic through a NAT Gateway. AWS provides different endpoint types, including Gateway Endpoints and Interface Endpoints. Interface Endpoints use AWS PrivateLink and make supported services reachable through private IP addresses in the VPC.
VPC Flow Logs are valuable when something does not communicate as expected. They provide information about IP traffic related to VPC networking resources and can help determine whether traffic is being accepted or rejected. They are especially useful when troubleshooting cases where an application team says that "the network is blocking the connection" but the exact failure point is unclear.
It is also important not to forget DNS. A network path can be completely correct while an application still fails because it cannot resolve the destination hostname. AWS provides DNS resolution capabilities through Route 53 Resolver. When troubleshooting, DNS should be checked alongside routes, Security Groups, NACLs, and operating system firewalls.
One of the strongest habits in AWS networking is to avoid immediately changing rules when something fails. Opening every port or allowing
0.0.0.0/0 may make a test work, but it does not explain the root cause and can introduce a security problem. A better approach is to follow the traffic from source to destination and verify each part of the path.For example, if one EC2 instance cannot reach another server, first confirm the source and destination addresses. Then check the subnet routes, Security Groups, NACLs, operating system firewall, and finally the application listening on the destination port. This method is usually faster than making several configuration changes at once.
A good production VPC design is not necessarily the most complicated design. It is one where the IP addressing is planned properly, resources are placed in the correct subnets, Internet exposure is limited, multiple Availability Zones are used where availability requires them, and routes and security policies are easy to understand.
Amazon VPC may initially look like just another AWS service, but it is really the network framework around many other services. EC2, RDS, ECS, EKS, load balancers, VPN connectivity, Transit Gateway, and PrivateLink all depend heavily on VPC networking concepts.
The most useful idea to remember is that successful AWS connectivity requires both a valid path and the correct permission. Routing determines where the packet goes, while security controls determine whether it is allowed to continue. Once that distinction becomes clear, both VPC design and troubleshooting become much easier.
A well-planned VPC gives an AWS environment room to grow. Good addressing, sensible subnet separation, controlled Internet access, and clear routing may seem like extra work at the beginning, but they can prevent much larger networking problems later.
Series: Modern Technology (5 articles)
- …
- 3Understanding AWS VPC: A Practical Look at How Networking Works in AWS This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article