DEV Community

47.jp. Yokhash.
47.jp. Yokhash.

Posted on

Yokhash Meets VPC: Exploring Amazon Virtual Private Cloud ☁️

πŸ“ Introduction

What is the AWS service?

Amazon VPC (Virtual Private Cloud) is a networking service that lets you create your own logically isolated section of the AWS cloud. Think of it as your own private data center β€” but instead of buying servers, switches, and cables, you define it entirely in software. Inside a VPC, you control your own IP address range, subnets, route tables, and gateways, and you decide exactly what can talk to what.

Why was it created?

Before VPC existed, all AWS EC2 instances launched into a shared public network space (called "EC2-Classic"), where every customer's resources sat in the same network pool with limited isolation. This made it hard to build secure, enterprise-grade architectures. AWS launched VPC in 2009 to give customers a way to isolate their resources, define custom network topologies, and connect their AWS environment safely to on-premises data centers β€” essentially bringing traditional network security and control into the cloud.

βš™οΈ How It Works

In simple terms: a VPC is a virtual network dedicated to your AWS account. When you create a VPC, you assign it an IP address range (called a CIDR block, e.g. 10.0.0.0/16). You then divide that range into smaller subnets, which can be:

  • Public subnets β€” connected to the internet through an Internet Gateway (for things like web servers)
  • Private subnets β€” isolated from the internet (for things like databases)

Traffic between subnets is controlled by route tables, and traffic in and out of instances is filtered by security groups (instance-level firewall) and network ACLs (subnet-level firewall).

Simple Flow Diagram

                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚                  VPC                      β”‚
                         β”‚              (10.0.0.0/16)                β”‚
                         β”‚                                            β”‚
   Internet  ──────►  Internet                                       β”‚
                       Gateway                                       β”‚
                         β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
                         β”œβ”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚ Public Subnet β”‚  EC2 (Web Server)β”‚
                         β”‚        β”‚ 10.0.1.0/24   β”‚                  β”‚
                         β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
                         β”‚                                            β”‚
                         β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
                         β”‚        β”‚ Private Subnetβ”‚  RDS (Database)  β”‚
                         β”‚        β”‚ 10.0.2.0/24   β”‚                  β”‚
                         β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Requests from the internet reach the public subnet through the Internet Gateway; the database in the private subnet is never directly reachable from outside.

πŸ”‘ Key Features

  1. Subnets & IP Addressing β€” You control your own IP range and split it into public/private subnets across different Availability Zones for high availability.
  2. Security Groups & Network ACLs β€” Fine-grained, layered firewall rules at both the instance level (security groups) and subnet level (NACLs), so you decide exactly what traffic is allowed in or out.
  3. VPC Peering & Transit Gateway β€” You can privately connect multiple VPCs together (even across accounts or regions) without routing traffic over the public internet.
  4. VPN & Direct Connect Integration β€” VPC can be securely connected to an on-premises network, letting a college's local campus network extend into AWS.

πŸŽ“ College/Student Use Case

Imagine a college hosting a student project portal (say, for internships, hackathon submissions, or a placement management system) on AWS:

  • The web application servers sit in a public subnet, accessible to students and faculty over the internet.
  • The database storing student records sits in a private subnet, completely shielded from direct internet access β€” only the web servers can reach it.
  • The college's IT department could use VPC peering to connect this project's VPC with another VPC used by a different department (e.g., the library management system) so both can share certain resources securely.
  • Security groups ensure only the college's own servers can query the database, protecting sensitive student data from external threats.

This mirrors exactly how real companies isolate public-facing apps from sensitive backend data.

πŸ’» Simple Example

A minimal VPC setup using the AWS CLI:

# 1. Create a VPC
aws ec2 create-vpc --cidr-block 10.0.0.0/16

# 2. Create a public subnet inside it
aws ec2 create-subnet --vpc-id vpc-xxxxxxxx --cidr-block 10.0.1.0/24

# 3. Create and attach an Internet Gateway
aws ec2 create-internet-gateway
aws ec2 attach-internet-gateway --vpc-id vpc-xxxxxxxx --internet-gateway-id igw-xxxxxxxx

# 4. Create a route table entry to send internet-bound traffic through the gateway
aws ec2 create-route --route-table-id rtb-xxxxxxxx \
  --destination-cidr-block 0.0.0.0/0 --gateway-id igw-xxxxxxxx
Enter fullscreen mode Exit fullscreen mode

This sequence creates an isolated network, adds a subnet that can reach the internet, and wires up the routing β€” the foundation any EC2 instance or RDS database would sit on top of.

βœ… Advantages

  • Full control over IP ranges, routing, and network topology
  • Strong isolation between your resources and everyone else on AWS
  • Flexible connectivity β€” link to on-premises networks, other VPCs, or keep resources fully private
  • Free to use β€” VPC itself has no additional charge (you pay only for resources like NAT Gateways, VPN connections, or data transfer)

⚠️ Limitations / Things to Consider

  • Cost: The VPC itself is free, but components like NAT Gateways, VPN connections, and Transit Gateway attachments can add up quickly for a class project on a tight budget.
  • Complexity: Designing subnets, route tables, and security groups correctly requires a real understanding of networking β€” it's easy to misconfigure and accidentally expose (or block) resources.
  • Scalability: A poorly planned CIDR block (too small an IP range) can limit how much you can grow later, so planning ahead matters.
  • Security: Since VPC is the foundation of your cloud security posture, mistakes here (like leaving a database subnet public) can expose an entire application β€” it demands careful configuration and regular review.

🏁 Conclusion

Amazon VPC is the networking backbone of almost everything else you do on AWS β€” it's usually the very first thing you set up before launching EC2 instances, databases, or any other service. Understanding VPC means understanding how to design secure, isolated, and well-connected cloud environments β€” a skill that's directly transferable to real-world cloud architecture, and a perfect starting point for any student exploring how large-scale applications are actually built and secured on AWS.

Top comments (0)