In Chapter 3: Terraform Modules, we introduced the concept of reusable infrastructure components through Terraform modules. We explored how modules help standardize and simplify the provisioning of critical cloud resources, such as Virtual Private Clouds (VPCs) and EKS clusters.
In this chapter, we’ll take a closer look at one of the most foundational infrastructure components: the VPC (Virtual Private Cloud). A VPC defines the isolated network environment in which all other AWS resources—like compute instances, databases, and Kubernetes clusters—operate. Understanding how the VPC module works is essential to designing secure, scalable, and well-organized cloud infrastructure.
Imagine AWS as a vast metropolitan city where organizations can deploy and run digital infrastructure. While this shared environment provides immense scalability and flexibility, no organization wants its resources directly exposed to or mixed with others. Just as you’d prefer your own private property within a busy city—complete with fencing, roads, and security—a VPC (Virtual Private Cloud) offers that same level of isolation and control in the cloud.
A VPC is a logically isolated section of the AWS cloud where you can define and manage your own networking environment. It provides a secure and private foundation on which all other AWS resources—such as EC2 instances, RDS databases, or EKS clusters—are deployed.
Key benefits of a VPC include:
Isolation
Your resources operate in a logically separate network, fully isolated from those of other AWS customers.
Control
You define the network topology—including IP address ranges, subnets, route tables, and gateways—according to your architectural and operational needs.
Security
Using network access control lists (ACLs), security groups, and route configurations, you can enforce fine-grained rules for inbound and outbound traffic.
In essence, a VPC is your private, fenced-off estate within AWS. You determine where resources are placed (subnets), how they communicate internally (routing), and what traffic is allowed to enter or exit (gateways and firewalls). This makes the VPC a foundational building block for secure and scalable cloud infrastructure.
A VPC is your private, isolated virtual network within AWS. It's the foundational layer for almost everything you build in AWS.
Let's break down the key parts of your cloud estate:
10.123.0.0/16) that only your VPC can use. No other VPC can use the exact same range in the same region, ensuring your network addresses don't clash with others.10.123.0.0/16 allows for a very large number of private IP addresses that your resources can use.10.123.1.0/24, 10.123.2.0/24).In our project, we use a Terraform module to provision the VPC. This module encapsulates all the logic and configurations needed to define the structure of our "estate"—including the overall IP address range, subnet layout, and access control points.