AWS Regions and Availability Zones
The AWS global infrastructure is organized in Regions and Availability Zones.
Region #
A Region is a separate geographic area, such as us-east-1 (N. Virginia), eu-west-1 (Ireland) or ap-southeast-1 (Singapore). Regions are independent: resources, VPCs, prices and the available services are specific to each Region, and data does not leave a Region unless you move it.
Criteria to choose a Region:
- Latency: close to your users.
- Compliance and data residency: where the data must legally stay.
- Service availability: new services usually launch in a few Regions first.
- Price: it varies between Regions.
Some Regions (for example, the newest ones) have to be enabled in the account before use.
Availability Zone (AZ) #
An Availability Zone is one or more data centers in a Region with independent power, cooling and networking, connected to the other zones of the Region by fast, low-latency links. Zones are named with a letter (us-east-1a, us-east-1b...). Those names are mapped to physical zones differently for each AWS account; the AZ ID (for example use1-az1) identifies the same zone for all of them.
A subnet lives in a single Availability Zone. To survive the failure of a data center, spread the EC2 instances, load balancers, NAT Gateways and databases (Multi-AZ) across at least two zones.
Other locations #
- Edge locations serve content and DNS for CloudFront and Route 53.
- Local Zones and Wavelength Zones bring services closer to large cities or 5G networks.
With Terraform #
The Region is set in the provider "aws" block (or with the AWS_REGION variable) and the available zones can be read with the aws_availability_zones data source:
data "aws_availability_zones" "available" {
state = "available"
}
# data.aws_availability_zones.available.names[0] -> "us-east-1a"
See tutorials:
More tutorials that use Regions and Availability Zones
- AWS Basic VPC Elements
- AWS with Terraform Tutorial: AWS Routing Tables (8)
- AWS VPC Subnets, Routing Tables and Internet Access using Terraform (2/5)
- AWS with Terraform Tutorial: AWS NAT Gateway (7)
- AWS VPC, Route 53, RDS MariaDB, EC2 using Ansible and Terraform (1/5)
- AWS with Terraform Tutorial: AWS RDS Instances (13)
- Terraform AWS EKS Cluster Deployment & Application Publishing through ALB
- AWS with Terraform Tutorial: AWS Auto Scaling (15)