Table of Contents
- Overview
- Types of Subnets
- Table: Types of Subnets in AWS
- Conclusion
Overview: AWS Networking – Types of Subnets
What Is It?
In AWS, a subnet (short for subnetwork) is a logical subdivision of an Amazon Virtual Private Cloud (VPC). Subnets let you divide your VPC’s IP address range into smaller segments, grouping resources based on security and operational requirements. Each subnet exists within a single Availability Zone in an AWS region.
Why Do You Need to Know About It?
Understanding AWS subnets is foundational for designing resilient, secure, and scalable cloud environments. Here’s why they matter:
- Security: Subnets help you segment and isolate resources, providing the ability to tightly control which workloads are internet-facing and which remain private.
- Compliance: Many compliance frameworks require network segmentation for sensitive data, which is easier to achieve using subnets.
- Performance and Availability: Placing resources in different subnets across multiple Availability Zones ensures higher availability and disaster recovery capabilities.
- Cost Management: Network design impacts data transfer costs; understanding subnets helps optimize for both performance and budget.
- Custom Routing: Subnets work with route tables and security groups, giving fine-grained control over inbound and outbound traffic.
How Does It Work?
A subnet operates by assigning a subset of IP addresses from the VPC’s overall address space. Each resource you launch within AWS—such as EC2 instances, databases, or containers—must reside in a subnet. Associating a subnet with different network components determines its connectivity:
- Public Subnet: Connected to an Internet Gateway, making its resources internet-accessible.
- Private Subnet: No direct internet access, typically using a NAT Gateway/Instance for outbound requests.
- VPN-Only/Isolated Subnet: Used for purely internal applications or connections to on-premises networks, without internet exposure.
Routing tables associated with each subnet control the flow of network traffic. Additional layers of control, such as Network ACLs and Security Groups, can be applied at the subnet or resource level for further protection and traffic management.
In essence, subnets are critical to defining your application’s network surface area, controlling access, and ensuring that AWS infrastructure meets both technical and business needs.
Types of Subnets
AWS subnets are categorized by their routing configuration and network accessibility. Understanding the types of subnets helps you properly architect secure and efficient cloud environments. Below is a practical overview, presented step by step:
-
Public Subnet:
- Has a direct route to an Internet Gateway (IGW).
- Resources inside can communicate with the public internet.
- Common use: web servers or any resource needing public inbound/outbound connectivity.
-
Private Subnet:
- Does not have a direct route to an Internet Gateway.
- Resources cannot receive traffic from the internet directly.
- Outbound internet possible via a NAT device (NAT Gateway or NAT Instance).
- Common use: databases, application servers, backend services.
-
VPN-Only Subnet:
- Has routes to a Site-to-Site VPN connection via a Virtual Private Gateway.
- No route to the Internet Gateway.
- Common use: resources securely connected to on-premises networks.
-
Isolated Subnet:
- Does not have routes outside of the VPC; completely isolated.
- No access to the internet or VPN.
- Common use: highly sensitive workloads or compliance-restricted data.
-
Dual Stack Subnet:
- Configured with both IPv4 and IPv6 CIDR blocks.
- Resources can use both protocols as needed for hybrid workloads or transitions.
-
IPv4-Only and IPv6-Only Subnets:
- IPv4-Only: Subnet has only an IPv4 CIDR block.
- IPv6-Only: Subnet has only an IPv6 CIDR block; resources require IPv6 connectivity.
Each subnet must be associated with a route table that defines its allowed outbound routes. The type of subnet primarily depends on how its route table is configured and what gateways or endpoints are included in its routes.
Subnet Type | Internet Access | Typical Use Case | Routing Configuration | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Public | Direct via Internet Gateway | Web servers, public APIs | Route to Internet Gateway | ||||||||||||||||||||||||||||||||
Private | No direct internet (outbound via NAT) | Databases, app servers | No IGW route; uses NAT for outbound | ||||||||||||||||||||||||||||||||
VPN-Only | No direct internet; access via VPN | On-premises connectivity | Route to VPN Gateway only | ||||||||||||||||||||||||||||||||
Isolated | None | Sensitive, isolated systems | Only local VPC routes | ||||||||||||||||||||||||||||||||
Dual Stack | IPv4 & IPv6 (as configured) | Hybrid protocol workloads | Table: Types of Subnets in AWS
This table summarizes the main types of AWS subnets, outlining their internet access, typical use cases, and routing configurations. Use this reference to choose the most appropriate subnet type for your AWS architecture:
Tip: The correct routing and gateway associations are crucial for enforcing security and enabling the expected connectivity for each subnet type. ConclusionThroughout this blog post on AWS Networking: Types of Subnets, we explored the core concepts behind subnets and their critical role within the Amazon Virtual Private Cloud (VPC) ecosystem. Key takeaways include:
Designing your AWS infrastructure with the right mix of subnets helps improve security posture, performance, and overall manageability. Whether you are orchestrating a scalable web application or building a secure enterprise architecture, subnets are a foundational element you can’t overlook. Thanks for reading, and we hope this helps you on your cloud journey. If you’re building your next architecture, now you know—start with subnets! 🚀 |