β Day 11 of My Cloud Journey β β AWS VPC Basics: Subnets, IGW & NAT Gateway Explained π‘οΈπ

Table of contents
Today I stepped into the networking side of AWS β learning about the backbone of secure and scalable cloud deployments: Amazon VPC (Virtual Private Cloud).
Mastering networking in the cloud is essential for building production-ready, secure, and scalable architectures. Whether it's hosting a secure app, launching a database, or creating a multi-tier application β it all starts with VPC!
π What is a VPC?
A Virtual Private Cloud (VPC) is a logically isolated network inside AWS that you define. You can control:
IP address ranges (CIDR blocks)
Subnets
Route tables
Internet access
Firewalls
Gateways
Itβs like having your own virtual data center β where you can run resources (like EC2, RDS, Lambda) in a highly secure and customizable environment.
π§© Core VPC Components I Explored Today:
πΈ 1. Subnets
A subnet is a segment of a VPC's IP address range where you can place AWS resources. There are two types:
Public Subnet β Connected to the internet via Internet Gateway.
Private Subnet β No direct access to the internet (great for databases, backend services).
You can split your application architecture:
Frontend in a public subnet
Backend or DB in a private subnet
πΈ 2. Internet Gateway (IGW)
An Internet Gateway enables instances in a public subnet to connect to the internet. Without it, your EC2 instances in public subnets cannot access or be accessed from the web.
β
I attached an IGW to my VPC
β
Updated route tables to allow 0.0.0.0/0
access through IGW
πΈ 3. NAT Gateway
A NAT (Network Address Translation) Gateway allows instances in private subnets to access the internet (for updates, packages) without being exposed to inbound internet traffic.
β
I placed the NAT Gateway in a public subnet
β
Added a route in private subnetβs route table to point 0.0.0.0/0
to the NAT Gateway
β
Tested internet access from EC2 in private subnet β Worked perfectly!
π‘ Why Use Public & Private Subnets?
Separating your application tiers into public and private subnets boosts security. For example:
Web server (NGINX): Public subnet
Database (MySQL/PostgreSQL): Private subnet
Backend service: Private subnet
NAT Gateway: Public subnet
This setup is the backbone of multi-tier architecture, where each layer is isolated and follows the principle of least privilege.
π Hands-on Tasks I Completed:
1οΈβ£ Created a custom VPC with custom CIDR block
2οΈβ£ Added 2 public and 2 private subnets across multiple availability zones
3οΈβ£ Attached and configured an Internet Gateway
4οΈβ£ Created a NAT Gateway in a public subnet
5οΈβ£ Set up custom route tables
6οΈβ£ Launched EC2 instances in both subnet types
7οΈβ£ Connected via SSH and tested access/connectivity
8οΈβ£ Verified internet access from private subnet via NAT
π§ Key Learnings:
β
How routing works between private/public subnets
β
Why NAT Gateway is essential for secure outbound traffic
β
How Internet Gateway enables global access to cloud servers
β
How to isolate workloads and restrict public access
β
Difference between Security Groups and Route Tables
π Real-World Use Cases of VPC:
πΉ Host static or dynamic web apps with secure backends
πΉ Run databases securely without internet exposure
πΉ Set up secure hybrid networks with VPN or Direct Connect
πΉ Create multi-tier application environments (frontend, backend, DB)
πΉ Build isolated test environments or dev/staging infrastructure
π Best Practices I Noted:
π Keep all critical services (e.g., DB, APIs) in private subnets
π Enable VPC Flow Logs for monitoring and troubleshooting
π Use IAM roles, not hardcoded credentials
π Use Security Groups for instance-level security and NACLs for subnet-level
π Avoid assigning public IPs unnecessarily
π Use multiple AZs for high availability
π Whatβs Next?
π Tomorrow (Day 12):
Iβll dive deeper into:
Route Tables
Security Groups vs NACLs
VPC Peering β how to connect multiple VPCs together
πΈ Want Visuals?
πΌοΈ Iβm also creating a visual diagram of my VPC layout and subnet routing β stay tuned on my LinkedIn!
π And here's a static portfolio site I hosted earlier on S3 + CloudFront from Day 9:
π View Project on LinkedIn
π Final Thoughts:
AWS VPC is the network foundation for everything you build in the cloud. It connects, isolates, secures, and scales your infrastructure. Without a strong grasp on VPC fundamentals, real-world cloud deployments can become a tangled mess.
This hands-on practice was crucial in understanding how everything works under the hood in cloud networking.
π·οΈ Hashtags:
#Day11 #30DaysOfCloud #AWS #VPC #Subnets #NATGateway #IGW #CloudNetworking #DevOps #LearnInPublic #Hashnode #TruptiMane #CloudSecurity #AWSBeginner #AmazonWebServices #CloudJourney
Subscribe to my newsletter
Read articles from Pratik Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
