AWS VPC Setup is the starting point for almost every serious cloud build. If you need secure Cloud Networking, clean VPC Configuration, and a usable Private Cloud pattern in AWS, the Virtual Private Cloud is where those decisions live.
This walkthrough builds a practical network layout: one VPC, public and private subnets, an Internet Gateway, a NAT Gateway, route tables, Security Groups, and Network ACLs. The goal is not just to make traffic move. The goal is to make traffic move for the right reasons, to the right places, with the right controls.
That matters because many AWS problems are really networking problems. An instance is “up,” but you cannot reach it. A database is private, but a route table or security rule is wrong. An application tier works in one Availability Zone but breaks in another. Good VPC design prevents those issues before they start.
Here is the architecture you will build mentally as you read: a VPC with a private address range, at least two public subnets, at least two private subnets, a route to the internet for public traffic, and outbound-only internet access for private workloads through NAT. You will also see where AWS services like Amazon VPC, Internet Gateway, NAT Gateway, Security Groups, and route tables fit into the design. For official terminology and service behavior, AWS documents the core constructs in the Amazon VPC User Guide.
Understanding AWS VPC Fundamentals
A Virtual Private Cloud is a logically isolated network in AWS. Think of it as your own virtual data center network, except AWS provides the underlay and you define the IP ranges, subnet structure, routing, and traffic controls. That is why AWS VPC Setup is foundational for cloud networking. Without it, you do not really have a secure or predictable application network.
The address plan starts with a CIDR block, which defines the IP range available inside the VPC. For example, a block like 10.0.0.0/16 gives you 65,536 addresses, while 10.0.1.0/24 gives you 256. The CIDR choice determines how many subnets you can carve out and how much room you have for growth. If you choose too small a block, you can paint yourself into a corner fast.
Public and private subnets are not just labels. A subnet becomes public when its route table includes a path to an Internet Gateway and the resources in it can receive public IPs. Private subnets do not have that direct internet path. They are the right place for databases, internal APIs, middleware, and anything that should not be directly reachable from the internet.
Other key pieces matter too. Route tables decide where packets go. Network ACLs provide stateless subnet-level filtering. Gateways connect the VPC to external networks. AWS explains these concepts in the VPC documentation, and the design patterns align closely with standard network segmentation practices used in enterprise environments.
Good VPC design is less about “getting online” and more about making access intentional.
Design also affects scalability. A clean network layout supports future peering, hybrid connectivity, and multi-tier application architectures. If you begin with a sloppy design, you inherit a routing and security problem that gets harder to fix as the environment grows.
- VPC: isolated network boundary.
- CIDR block: IP space allocated to the VPC.
- Subnet: segmented network slice inside the VPC.
- Route table: traffic forwarding rules.
- Security Group: stateful instance-level firewall.
- Network ACL: stateless subnet-level filter.
Planning Your VPC Architecture for AWS VPC Setup
Start with the address plan. Choose an IP range that does not overlap with your on-premises network, VPN ranges, or other cloud environments. Overlapping CIDR ranges are one of the most common reasons hybrid connectivity fails. If you ever plan to use site-to-site VPN, Direct Connect, or VPC peering, overlap is not a nuisance; it is a design blocker.
A practical pattern is to reserve broad, non-overlapping ranges by environment. For example, production, development, and testing can each get distinct network blocks. This gives you room to grow and makes routing simpler later. That kind of planning is common in enterprise Cloud Networking because routing conflicts are expensive to untangle once systems are live.
High availability should drive subnet planning. At a minimum, spread public and private subnets across two Availability Zones. If one zone fails, workloads in the other zone should continue. This is especially important for internet-facing applications, load-balanced web tiers, and databases that require resilience. AWS recommends designing for fault isolation across Availability Zones in its architecture guidance.
Decide which resources should be internet-facing and which should remain private. A web server may live in a public subnet, but its database should not. Application servers often belong in private subnets behind a load balancer. Internal management tools, CI/CD runners, and backend services usually belong in private subnets as well.
Key Takeaway
Plan the network around future connectivity needs, not just the first application. VPC design becomes harder to change after workloads depend on it.
Also plan for future growth. Ask whether you will need additional VPCs, peering, transit routing, or shared services. If you expect expansion, keep enough unused address space for new subnets. That small decision can save major redesign work later.
- Pick a non-overlapping CIDR range.
- Reserve enough IP space for future subnets.
- Use at least two Availability Zones.
- Separate internet-facing and private workloads.
- Account for peering, VPN, or shared services now.
Creating the VPC and Configuring the CIDR Block
In the AWS Management Console, open the VPC service and create a new VPC. Select an IPv4 CIDR range that fits the workload and the future growth plan. A common private range is 10.0.0.0/16, because it provides enough room for many subnets without forcing immediate redesign. This is a standard approach for internal AWS networks and a good starting point for a clean VPC Configuration.
If IPv6 is relevant to your environment, AWS supports assigning IPv6 CIDR blocks to VPCs and subnets. IPv6 is useful when you want broad address availability and native IPv6 connectivity. It is also helpful for organizations with dual-stack requirements. The official AWS VPC documentation explains how IPv6 behaves differently from IPv4, especially around route tables and internet access.
Your VPC CIDR affects every subnet you build. Each subnet must fit within the parent VPC range. That means you should think in terms of future subnet allocation before clicking Create. If you know you need multiple application tiers, a public ingress layer, a database tier, and room for shared services, the VPC block should reflect that structure.
One common mistake is choosing a range that is too small because the first application is small. That is short-term thinking. A /24 VPC leaves very little room once you divide it among public and private subnets across multiple zones. Another mistake is reusing an on-premises range because “it was available.” That leads to painful routing conflicts later.
Warning
Do not pick a CIDR range just because it looks simple. Check current VPN, Direct Connect, peering, and legacy network ranges before you commit.
After creation, tag the VPC clearly. Tags like Name, Environment, Owner, and CostCenter make operations easier. In larger environments, poor naming becomes a support problem because engineers cannot quickly tell which VPC belongs to which application or account.
Designing Public and Private Subnets
Subnets are where the VPC becomes useful. Create public subnets for resources that need inbound internet access, such as load balancers, bastion hosts if you use them, or public-facing web servers. Create private subnets for databases, internal application servers, caches, and services that should not accept direct internet traffic. This is the core pattern behind a secure Private Cloud deployment in AWS.
Distribute subnets across multiple Availability Zones. A common layout is one public subnet and one private subnet in each of two zones, or even three if the workload justifies it. That way, you can place components close to the users and survive a single-zone disruption more gracefully. AWS architecture best practices consistently emphasize zone diversity for resilience.
Subnet sizing matters. If you assign a /28 to a public subnet, you will run out of usable IPs quickly once instances, load balancers, and future scaling are added. For private subnets, leave extra room for horizontal scaling, replacement instances, and managed services that consume addresses. Think ahead by several months, not several days.
Good subnet naming and tagging are not cosmetic. They are operational controls. Use names like public-a, public-b, private-app-a, and private-db-b. That makes route table associations, troubleshooting, and infrastructure as code much easier to read and maintain. It also helps when multiple teams share the same AWS account.
- Public subnet: internet-facing resources.
- Private application subnet: app servers, workers, internal APIs.
- Private database subnet: RDS or self-managed data layers.
- Shared-services subnet: logging, monitoring, or management tools.
Think of subnet design as workload placement policy. The subnet should reflect how the resource is allowed to communicate, not just where you happen to place it first.
Attaching and Configuring an Internet Gateway
An Internet Gateway is the AWS component that allows traffic to flow between your VPC and the internet. It is not enough to create it. You must attach it to the VPC and update route tables so public subnet traffic knows where to go. AWS documents this clearly in the Internet Gateway guide.
The actual process is straightforward. Create the gateway, attach it to the VPC, then add a route in the public subnet route table for 0.0.0.0/0 pointing to the Internet Gateway. That tells instances in the public subnet that unknown destinations should go to the internet. Without that route, the subnet is not public, even if the name suggests otherwise.
Public reachability also requires a public IP address or Elastic IP on the instance or load balancer. The route alone is not enough. If you launch an EC2 instance in a public subnet and do not assign a public IPv4 address, it still cannot be reached from the internet. That detail confuses many people new to AWS VPC Setup.
Security matters here. A public subnet is not automatically unsafe, but anything reachable from the internet must be tightly controlled. Use Security Groups, restrict inbound ports, and avoid exposing administrative services unless absolutely necessary. In most cases, SSH should be limited to a narrow source range or replaced with a more controlled access pattern.
Pro Tip
When testing public access, verify three things: the subnet route table, the instance public IP, and the Security Group. If one is missing, the connection fails.
Setting Up NAT Gateway for Private Subnet Internet Access
Private subnets cannot use an Internet Gateway for direct inbound or outbound internet access. That is the point. If a private instance needs to download patches, call external APIs, or access package repositories, it needs a controlled outbound path. A NAT Gateway provides that path by translating private source addresses to a public address for outbound traffic only.
Place the NAT Gateway inside a public subnet and attach an Elastic IP to it. Then update the private subnet route table so 0.0.0.0/0 points to the NAT Gateway instead of the Internet Gateway. This lets private instances initiate outbound connections while still blocking unsolicited inbound connections from the internet. AWS explains the behavior in its NAT Gateway documentation.
NAT Gateway is usually preferred over a NAT instance because it is managed and highly available within an Availability Zone. It removes the need for patching, instance maintenance, and manual scaling. The tradeoff is cost. NAT Gateways cost more than a small self-managed instance, but they reduce operational burden and improve reliability. For production networks, that is often worth the price.
If cost is a concern in development or low-traffic environments, some teams still consider NAT instances. The tradeoff is clear: lower direct compute cost versus more administrative overhead and less resilience. For most enterprise workloads, NAT Gateway is the cleaner long-term choice.
Outbound-only internet access is not a compromise. It is a control mechanism.
Do not forget to protect the NAT subnet itself. Because the gateway is public-facing in the sense that it needs public internet connectivity, it should live in a public subnet with tightly managed routing and security boundaries.
Configuring Route Tables and Traffic Flow
Route tables determine how packets move inside and outside the VPC. Every subnet is associated with one route table, and that table decides the default paths for traffic. This is where many networking errors hide, because the subnet may look correct while the route table sends traffic to the wrong destination.
Public subnets should have a default route, 0.0.0.0/0, pointing to the Internet Gateway. Private subnets should have a default route pointing to the NAT Gateway if outbound internet access is required. All subnets also receive a local route that allows communication within the VPC CIDR block. That local route is what makes internal traffic between subnets work without additional rules.
Proper association is critical. If a subnet is attached to the wrong route table, traffic will fail even if the instances and security rules appear correct. A public subnet with a private route table will not reach the internet. A private subnet with no NAT route will fail on package updates, yum/apt installs, and external API calls.
Common troubleshooting issues include blackhole routes, deleted gateways, and accidental route table associations. A blackhole route appears when the target resource no longer exists, such as a deleted NAT Gateway. That route still exists in the table, but traffic cannot follow it. AWS route table status indicators help reveal that problem quickly.
Note
Use the AWS console route table view or CLI to confirm the active target for each default route. A correct subnet design with a wrong association still fails.
For larger environments, keep route tables simple. Use separate tables only when the traffic policy differs. Too many route tables create confusion and make changes harder to audit. Clear segmentation beats cleverness.
Securing the VPC with Security Groups and Network ACLs
Security Groups are stateful instance-level firewalls. If you allow inbound HTTPS, return traffic is automatically allowed back out. Network ACLs are stateless subnet-level controls, so return traffic must be explicitly allowed in both directions. That difference matters when you troubleshoot why one layer works and the other blocks traffic.
Use Security Groups as the primary control. Allow only required inbound ports. For a web server, that may be 443 from the load balancer or a trusted source range. For a database, allow only the application subnet on the database port, such as 3306 for MySQL or 5432 for PostgreSQL. Keep outbound rules equally restrained unless a workload truly needs open egress.
Use Network ACLs when you need an additional subnet-level barrier, especially in segmented environments or compliance-driven designs. They are helpful for broad deny rules, but they are more error-prone than Security Groups because they are stateless and evaluated in rule order. Many teams keep them simple and rely on Security Groups for most day-to-day control.
The principle is least privilege. If a server only needs to talk to an application tier and a package repository, allow only those flows. Review rules periodically. Old test ports, temporary source ranges, and forgotten admin access often linger long after they stop being needed.
- Allow SSH only from a controlled source IP or management network.
- Allow HTTPS from users or a load balancer, not the entire internet unless required.
- Allow database ports only from app subnets.
- Restrict outbound internet access when business logic permits.
This layered approach matches common enterprise security guidance and reduces the chance of accidental exposure.
Launching and Testing an EC2 Instance in the VPC
The best way to validate your VPC Configuration is to launch real instances. Start with an EC2 instance in a public subnet. Assign a public IP address, attach a Security Group that allows the correct inbound port, and verify that you can connect over SSH or reach a web service. If that fails, you know the problem is in routing, public IP assignment, or Security Group policy.
Then launch a second instance in a private subnet. Do not assign a public IP. From that instance, test outbound connectivity by reaching a package repository or a known internet endpoint. If the NAT Gateway and route table are correct, outbound traffic should work. If it fails, check the private route table first, then NAT placement, then the Elastic IP attachment.
Test internal access too. A public or bastion-style management instance can often reach a private instance on an application port if the Security Group rules allow it. That confirms that local VPC routing is working and that the subnet design supports east-west traffic between tiers.
This validation step is not optional. It proves the design under actual packet flow rather than assuming the console settings are right. It also gives you a repeatable baseline for future deployments. If a later change breaks connectivity, you now know what “working” looked like.
Pro Tip
Use simple tests first: ping is often blocked, so test the actual service port with curl, nc, or SSH instead of assuming ICMP will tell the full story.
Best Practices for VPC Design and Operations
Use strong naming conventions and tags from day one. Every VPC resource should tell you what it is, what environment it belongs to, and who owns it. In larger AWS estates, this is essential for cost allocation, operations, and automation. A clean tag strategy also helps when using scripts, policies, or infrastructure-as-code pipelines.
Minimize public exposure. Keep only the resources that genuinely need internet access in public subnets, and push everything else into private subnets. That is the safest default for cloud networking. It also aligns with the security posture many auditors and internal review teams expect.
Enable VPC Flow Logs for visibility. Flow logs help you see accepted and rejected traffic patterns, which is useful for troubleshooting and for spotting unexpected communication. AWS supports flow logging at the VPC, subnet, or network interface level, so you can collect the amount of detail you need without logging everything indiscriminately.
Consider VPC endpoints for private access to AWS services like S3 or DynamoDB. If workloads only need AWS service access, endpoints can reduce or eliminate the need for internet egress through NAT. That reduces cost and narrows the external attack surface. This is a common enterprise optimization in mature AWS VPC Setup patterns.
Use infrastructure as code wherever possible. CloudFormation or Terraform makes VPC builds repeatable, reviewable, and version-controlled. Manual console changes are fine for learning, but they do not scale well in production. Repeatability is a core advantage of cloud infrastructure.
- Tag every resource.
- Keep public subnets small and intentional.
- Log traffic with VPC Flow Logs.
- Use endpoints for private AWS service access.
- Automate changes with infrastructure as code.
Common Mistakes and Troubleshooting Tips
The most common mistake is a wrong or missing route table association. A subnet can look correct, but if it is not associated with the expected route table, traffic goes nowhere useful. Always verify the subnet-to-route-table mapping before looking elsewhere. AWS Reachability Analyzer can help trace network paths and identify where connectivity breaks.
Another frequent issue is a security group that blocks traffic even though routing is correct. This happens all the time with database connections, administrative access, and application tier communication. If routing works but the port is closed, Security Groups are often the culprit. Remember that Security Groups are stateful, while Network ACLs are not.
NAT Gateway problems usually come down to placement or configuration. The NAT Gateway must be in a public subnet and must have an Elastic IP. The private subnet must route its default traffic to that NAT Gateway. If one of those pieces is missing, outbound access fails. Also check whether the NAT Gateway is in the same Availability Zone as the private subnet you are testing if your architecture depends on zone-local design.
Subnet IP exhaustion is another hidden failure mode. If a subnet runs out of available IPs, new instances cannot launch even though the network “looks” healthy. Check available addresses before scaling. In busy environments, small subnets become operational bottlenecks surprisingly fast.
Note
Use VPC Flow Logs for traffic evidence and Reachability Analyzer for path analysis. Together they cut troubleshooting time dramatically when a connection fails.
Also verify instance network settings. Make sure the instance is in the correct subnet, has the right Security Group, and has public IP assignment when needed. Small mistakes at launch time create the majority of connectivity problems later.
The AWS Reachability Analyzer and VPC Flow Logs are worth using early, not just after things break.
Conclusion
A well-built VPC is more than a networking container. It is the control plane for secure AWS deployments. When you get the address plan, subnet layout, route tables, Internet Gateway, NAT Gateway, and Security Groups right, the rest of the environment becomes easier to build and easier to defend. That is the real value of disciplined Cloud Networking.
The architecture covered here gives you a strong baseline: public subnets for controlled ingress, private subnets for sensitive workloads, outbound internet access through NAT, and layered security through Security Groups and Network ACLs. You also have the operational pieces that make the network maintainable, including tags, flow logs, and infrastructure as code. Those are not extras. They are part of a usable design.
Adapt the pattern to your workload. Add VPC endpoints when private AWS service access makes sense. Add peering or transit routing when you need to connect multiple networks. Introduce load balancers, shared services, or multi-account networking when the environment grows. The best AWS VPC Setup is the one that fits the workload now and still makes sense six months from now.
Vision Training Systems helps IT professionals build the practical skills behind designs like this, from AWS fundamentals to production-ready network planning. If you want your team to move from “console familiarity” to real implementation ability, this is the kind of hands-on skill set worth investing in.
Start with one VPC. Build it cleanly. Test it thoroughly. Then reuse the same design principles everywhere else.