Cloud Subnets — Designing Scalable and Secure Network Segments¶
A Subnet (Subnetwork) is a logical subdivision of a network that divides a larger IP address space into smaller, manageable network segments. In cloud platforms such as AWS, Microsoft Azure, and Google Cloud, subnets are used to organise workloads, improve security, optimize routing, and build highly available architectures. Every Virtual Machine, Kubernetes Node, Database, Load Balancer, and Application is deployed inside a subnet. Understanding subnet design is one of the most important networking skills for Cloud Architects, DevOps Engineers, Platform Engineers, Site Reliability Engineers (SRE), Network Engineers, and Security Engineers.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand cloud subnets
- Design subnet architectures
- Calculate subnet sizes
- Differentiate public and private subnets
- Plan IP addressing for cloud environments
- Build highly available network designs
- Apply subnet best practices across AWS, Azure, and Google Cloud
Prerequisites¶
Complete:
- IPv4 Addressing
- Classless Inter-Domain Routing (CIDR)
- Subnetting
- AWS VPC
- Azure VNet
- Google Cloud VPC
Why Are Subnets Needed?¶
Imagine a VPC with:
containing:
- Web Servers
- Databases
- Kubernetes
- Monitoring
- Bastion Hosts
Without subnets:
Problems:
- Difficult Security
- Large Broadcast Domains
- Poor Organization
- Complex Routing
Subnets solve these problems.
What is a Subnet?¶
A subnet is:
Example:
Why Divide Networks?¶
Benefits include:
- Better Security
- Simplified Management
- Traffic Isolation
- Easier Troubleshooting
- Scalable Architecture
- High Availability
CIDR Review¶
Example:
Contains:
Create smaller subnets:
Contains:
Common Subnet Sizes¶
| CIDR | Total Addresses |
|---|---|
| /24 | 256 |
| /25 | 128 |
| /26 | 64 |
| /27 | 32 |
| /28 | 16 |
Note: Cloud providers reserve some IP addresses in every subnet, so the number of usable addresses is lower than the total.
Public Subnet¶
A public subnet:
- Has a route to the Internet
- Can host Internet-facing resources
- May contain public IP addresses
Typical resources:
- Web Servers
- Bastion Hosts
- Public Load Balancers
- Network Address Translation (NAT) Gateways
Architecture:
Private Subnet¶
A private subnet:
- Has no direct Internet route
- Cannot receive unsolicited Internet traffic
- Uses NAT for outbound connectivity when required
Typical resources:
- Databases
- Application Servers
- Kubernetes Worker Nodes
- Internal APIs
- Cache Servers
Architecture:
Multi-Tier Architecture¶
Each tier has:
- Separate Security Policies
- Separate Routes
- Separate Access Controls
Multi-AZ Design¶
Production deployments span multiple Availability Zones (AZs).
Benefits:
- High Availability
- Fault Tolerance
- Disaster Recovery
IP Planning¶
Poor IP planning creates problems later.
Good example:
Leave unused ranges for future expansion.
Production Subnet Layout¶
Reserved IP Addresses¶
Cloud providers reserve IP addresses within every subnet.
Examples include:
- Network Address
- Default Gateway
- Internal Cloud Services
- Broadcast Address (where applicable)
Always consider reserved addresses during subnet planning.
AWS Perspective¶
AWS subnets:
- Belong to a single Availability Zone
- Can be Public or Private
- Use Route Tables
- Use Security Groups and Network Access Control Lists (NACLs)
Example:
Azure Perspective¶
Azure subnets:
- Exist inside a VNet
- Use Network Security Groups (NSGs)
- Support User-Defined Routes (UDRs)
- Integrate with Azure Firewall
Example:
Google Cloud Perspective¶
Google Cloud:
- Uses Regional Subnets
- Global VPC
- Firewall Rules
- Cloud NAT
- Shared VPC
Example:
Kubernetes Perspective¶
Production Kubernetes clusters often use dedicated subnets.
Example:
This improves isolation and security.
Enterprise Example¶
Each tier resides in its own subnet.
Cloud Architecture Example¶
VPC / VNet
↓
Public Subnets
↓
Application Load Balancer
↓
Private Application Subnets
↓
Private Database Subnets
↓
Backup Subnet
This architecture is commonly used across AWS, Azure, and Google Cloud.
Common Subnet Designs¶
| Subnet | Purpose |
|---|---|
| Public | Internet-facing workloads |
| Private | Internal applications |
| Database | Databases |
| Management | Administrative access |
| Monitoring | Monitoring and logging |
| Kubernetes | Worker nodes and Pods |
Hands-on Lab¶
Task 1¶
Create a subnet plan for:
using:
- Public
- Application
- Database
- Management
subnets.
Task 2¶
Calculate usable addresses for:
Task 3¶
Design a multi-AZ architecture with:
- Two Public Subnets
- Two Application Subnets
- Two Database Subnets
Task 4¶
Plan subnet allocation for a Kubernetes cluster.
Task 5¶
Create a subnet layout supporting:
- 500 Web Servers
- 300 Application Servers
- 100 Databases
Select appropriate CIDR ranges.
Task 6¶
Compare subnet implementation across:
- AWS
- Azure
- Google Cloud
Task 7¶
Design a hybrid cloud subnet plan connecting an on-premises data centre with cloud resources.
Task 8¶
Draw a production cloud architecture showing:
- Public Subnets
- Private Subnets
- Route Tables
- NAT Gateway
- Internet Gateway
- Load Balancer
- Database Tier
Explain how traffic flows between each subnet.
Production Troubleshooting¶
Problem:
Verify:
- Both workloads are in the expected subnets.
- Route tables allow communication.
- Firewall or security rules permit traffic.
- Network ACLs or NSGs are not blocking access.
- Domain Name System (DNS) resolves the correct private address.
Workflow:
Cloud Comparison¶
| AWS | Azure | Google Cloud |
|---|---|---|
| AZ-specific Subnets | Regional Subnets | Regional Subnets |
| Route Tables | Route Tables + UDRs | Global Routes |
| Security Groups | NSGs | Firewall Rules |
| NAT Gateway | NAT Gateway | Cloud NAT |
Common Mistakes¶
❌ Using one subnet for every workload.
✅ Separate workloads by function.
❌ Creating very small subnets.
✅ Leave room for future growth.
❌ Overlapping CIDR ranges.
✅ Plan address spaces carefully.
❌ Placing databases in public subnets.
✅ Always keep databases private.
❌ Ignoring cloud-reserved IP addresses.
✅ Account for reserved addresses during planning.
Best Practices¶
- Design subnet layouts before deployment.
- Separate application tiers into different subnets.
- Use private subnets for backend services.
- Deploy across multiple Availability Zones.
- Leave unused IP space for future expansion.
- Use consistent naming conventions.
- Document subnet allocations.
- Review subnet utilization regularly.
Interview Questions¶
Beginner¶
- What is a subnet?
- Why do we divide networks into subnets?
- What is the difference between a public and private subnet?
- Why are subnets important in cloud networking?
Intermediate¶
- Explain subnet planning for a production application.
- Compare AWS, Azure, and GCP subnet implementations.
- How do you determine the correct subnet size?
- Why should databases be deployed in private subnets?
Architect Level¶
- Design a highly available subnet architecture for a multi-region application.
- Explain how subnet design impacts scalability and security.
- How would you plan IP addressing for an enterprise cloud migration?
Summary¶
In this lesson, you learned:
- Cloud Subnets
- CIDR Planning
- Public and Private Subnets
- Multi-Tier Architecture
- Multi-AZ Design
- IP Address Planning
- Cloud Provider Differences
- Enterprise Network Design
Subnets are the foundation of cloud network design. They provide logical separation, improve security, simplify routing, and enable scalable architectures across AWS, Microsoft Azure, and Google Cloud. Well-designed subnet layouts are essential for building resilient, secure, and production-ready cloud environments.
Key Takeaways¶
- A subnet is a logical subdivision of a larger network.
- Public subnets host Internet-facing resources.
- Private subnets protect backend services and databases.
- Plan CIDR ranges carefully to support future growth.
- Deploy workloads across multiple Availability Zones for high availability.
- Effective subnet design improves security, scalability, and operational efficiency.
What's Next?¶
In the next lesson, you'll learn about Route Tables.
You'll explore:
- What Route Tables are
- Static and Dynamic Routes
- Default Routes
- Internet Routing
- Private Routing
- Route Priorities
- Cloud Routing Best Practices
By the end of the lesson, you'll understand how cloud platforms determine where network traffic is forwarded and how to design efficient routing for production cloud environments.