AWS Subnets
AWS Subnets are segmented sections within an Amazon Virtual Private Cloud (VPC). They partition the IP address range of a VPC, allowing further segregation of resources and providing a way to organize and manage network traffic within the VPC.
Subnets are associated with specific Availability Zones (AZs) within an AWS Region and can be public or private to organize and secure network traffic:
- Public subnets: have a route to the Internet via an Internet gateway and assign public IP addresses to their instances making it possible for instances to send and receive traffic from the Internet directly.
- Private subnets: typically do not have direct internet access and are used for resources that should not be publicly accessible. A NAT Gateway is needed to access the Internet (for example, to download software updates).
AWS regions are separate geographic areas where AWS maintains multiple data centers called availability zones (AZs). Availability zones within a region are isolated from each other in terms of infrastructure to enhance fault tolerance and stability. These zones are interconnected but operate independently, providing redundancy and resilience against failures.
The diagram below corresponds to the tutorial AWS with Terraform: The Essential Guide – AWS Subnets and shows the us-east-1 Region with some of its Availability Zones.
AWS subnets are closely tied to availability zones (AZs) within a region. Each subnet is associated with a specific availability zone. When creating a subnet, specify the availability zone in which that subnet resides.
This linkage between subnets and availability zones allows:
- High Availability: Placing subnets in different availability zones enables redundancy and fault tolerance. If one availability zone experiences issues, resources in subnets associated with other availability zones can remain unaffected.
- Low Latency: Placing resources in subnets within the same availability zone can minimize latency and increase performance as communication within the same AZ typically has lower latency than across different AZs.
- Optimized Networking: AWS services can automatically distribute traffic across availability zones when subnets are used in conjunction with services like load balancers, ensuring balanced and efficient resource utilization.
Subnets in different availability zones provide a foundational architecture for fault tolerance, performance optimization, and reliable connectivity within an AWS region.
More tutorials that use Subnets
- AWS with Terraform Tutorial: AWS Subnets (5)
- AWS Basic VPC Elements
- AWS VPC Subnets, Routing Tables and Internet Access using Terraform (2/5)
- AWS with Terraform Tutorial: AWS Routing Tables (8)
- AWS VPC, Route 53, RDS MariaDB, EC2 using Ansible and Terraform (1/5)
- AWS with Terraform Tutorial: AWS NAT Gateway (7)
- AWS with Terraform Tutorial: AWS RDS Instances (13)
- Terraform AWS EKS Cluster Deployment & Application Publishing through ALB