Subnet
💡 Definition
A Subnet is a range of IP addresses in your VPC. You launch AWS resources (like EC2 instances) into a specific subnet. Use a public subnet for resources that must be connected to the internet, and a private subnet for resources that won't be connected to the internet.
🔑 Key Concepts
- VPC Partition: Divides a VPC into smaller networks.
- AZ Specific: A subnet resides entirely within one AZ; it cannot span zones.
- Public Subnet: Has a route to an Internet Gateway.
- Private Subnet: Does not have a direct route to the internet. Uses a NAT Gateway for outbound access.
⚙️ How it Works
- Create VPC: Define the main CIDR block (e.g.,
10.0.0.0/16). - Create Subnet: Define a smaller CIDR block (e.g.,
10.0.1.0/24) and select an AZ. - Route Table: Associate the subnet with a route table that determines where traffic goes.
🎯 Use Cases
- Isolation: Separating public-facing web servers from backend database servers.
- High Availability: Creating subnets in different AZs to deploy redundant resources.
💰 Pricing Model
- Free: There is no additional charge for creating subnets.
📝 Exam Tips (CLF-C02)
- Subnets map to a single Availability Zone.
- Public vs. Private depends on the Route Table (specifically, a route to the IGW).
- 5 IP addresses are reserved by AWS in every subnet.
See Also: * VPC * Internet Gateway * NAT Gateway * Route Table