Subnets
Subnets in Amazon VPC
ℹ️ What is a Subnet?
- A subnet is a segment of the IP address range within an Amazon VPC
- It provides network space for AWS resources such as Amazon EC2 and Amazon RDS
- It is defined by a CIDR block (e.g., 10.0.1.0/24, 192.168.0.0/24)
- A subnet’s CIDR must fall within the VPC’s CIDR block
⚠️ Limits and Rules
- The smallest subnet you can create is /28 (16 IP addresses)
- AWS reserves 5 IP addresses in every subnet:
- The first 4 IP addresses
- The last IP address
- Example: a /28 subnet has 11 usable IP addresses (16 - 5)
ℹ️ Availability Zones and Subnets
- Each Availability Zone (AZ) is an independent data center
- An AZ can contain multiple subnets
- A subnet can exist in only a single AZ
💡 Subnet Types
-
Public Subnet
- Has a route table entry connected to an Internet Gateway (IGW)
- Allows direct connectivity to the internet
-
Private Subnet
- Has no route table entry connected to an IGW
- Isolated from the public internet
-
VPN-only Subnet
- Route table directs traffic through a Virtual Private Gateway (VPG)
- Used for VPN connectivity
🔒 Security Note
Regardless of subnet type, internal IP address ranges are always private and cannot be reached directly from the internet.
