CloudWiki
Resource

Availability Zone

Amazon Web Services
Compute
An AWS Availability Zone (AZ) is a physically separate data center within an AWS Region that is designed to be isolated from failures in other Availability Zones. Each Availability Zone has its own power and network infrastructure and is connected to other Availability Zones within the same Region through low-latency links.AWS customers can deploy applications and services across multiple Availability Zones within a Region to achieve high availability and fault tolerance. By distributing workloads across multiple Availability Zones, customers can ensure that their applications and services remain available even if one or more Availability Zones go offline due to a natural disaster, power outage, or other unexpected event.AWS currently has more than 80 Availability Zones across 25 geographic Regions worldwide. Each Availability Zone is designed to provide high levels of security, reliability, and scalability, and can be used in combination with other AWS services to build highly available and fault-tolerant applications and services.‍
Terraform Name
terraform
aws_availability_zone
Availability Zone
attributes:

The arguments of this data source act as filters for querying the available availability zones. The given filters must match exactly one availability zone whose data will be exported as attributes.

  • all_availability_zones - (Optional) Set to true to include all Availability Zones and Local Zones regardless of your opt in status.
  • filter - (Optional) Configuration block(s) for filtering. Detailed below.
  • name - (Optional) Full name of the availability zone to select.
  • state - (Optional) Specific availability zone state to require. May be any of "available", "information" or "impaired".
  • zone_id - (Optional) Zone ID of the availability zone to select.

filter Configuration Block

The following arguments are supported by the filter configuration block:

  • name - (Required) Name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.
  • values - (Required) Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • group_name - For Availability Zones, this is the same value as the Region name. For Local Zones, the name of the associated group, for example us-west-2-lax-1.
  • name_suffix - Part of the AZ name that appears after the region name, uniquely identifying the AZ within its region. For Availability Zones this is usually a single letter, for example a for the us-west-2a zone. For Local and Wavelength Zones this is a longer string, for example wl1-sfo-wlz-1 for the us-west-2-wl1-sfo-wlz-1 zone.
  • network_border_group - The name of the location from which the address is advertised.
  • opt_in_status - For Availability Zones, this always has the value of opt-in-not-required. For Local Zones, this is the opt in status. The possible values are opted-in and not-opted-in.
  • parent_zone_id - ID of the zone that handles some of the Local Zone or Wavelength Zone control plane operations, such as API calls.
  • parent_zone_name - Name of the zone that handles some of the Local Zone or Wavelength Zone control plane operations, such as API calls.
  • region - Region where the selected availability zone resides. This is always the region selected on the provider, since this data source searches only within that region.
  • zone_type - Type of zone. Values are availability-zone, local-zone, and wavelength-zone.

Associating resources with a
Availability Zone
Resources do not "belong" to a
Availability Zone
Rather, one or more Security Groups are associated to a resource.
Create
Availability Zone
via Terraform:
The following HCL shows how this data source might be used to derive VPC and subnet CIDR prefixes systematically for an availability zone.
Syntax:

variable "region_number" {
 # Arbitrary mapping of region name to number to use in
 # a VPC's CIDR prefix.
 default = {
   us-east-1      = 1
   us-west-1      = 2
   us-west-2      = 3
   eu-central-1   = 4
   ap-northeast-1 = 5
 }
}

variable "az_number" {
 # Assign a number to each AZ letter used in our configuration
 default = {
   a = 1
   b = 2
   c = 3
   d = 4
   e = 5
   f = 6
 }
}

# Retrieve the AZ where we want to create network resources
# This must be in the region selected on the AWS provider.
data "aws_availability_zone" "example" {
 name = "eu-central-1a"
}

# Create a VPC for the region associated with the AZ
resource "aws_vpc" "example" {
 cidr_block = cidrsubnet("10.0.0.0/8", 4, var.region_number[data.aws_availability_zone.example.region])
}

# Create a subnet for the AZ within the regional VPC
resource "aws_subnet" "example" {
 vpc_id     = aws_vpc.example.id
 cidr_block = cidrsubnet(aws_vpc.example.cidr_block, 4, var.az_number[data.aws_availability_zone.example.name_suffix])
}

Create
Availability Zone
via CLI:
Parametres:

describe-availability-zones
[--filters <value>]
[--zone-names <value>]
[--zone-ids <value>]
[--all-availability-zones | --no-all-availability-zones]
[--dry-run | --no-dry-run]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]

Example:

aws ec2 describe-availability-zones

aws cost
Costs
There are no additional costs associated with using an AWS Availability Zone (AZ) beyond the costs of the services you use within that AZ. When you use AWS services, you are charged based on the resources you consume, such as compute resources, storage, data transfer, and other services. The costs of using these resources are the same whether they are deployed in a single AZ or across multiple AZs within a Region. However, it's important to note that using multiple AZs can help improve the availability and fault tolerance of your applications and services, which can help reduce downtime and improve the overall user experience. Additionally, using multiple AZs may require additional configuration and management overhead, which could impact your operational costs. It's also worth noting that data transfer costs may vary depending on whether data is transferred within the same AZ or across multiple AZs within a Region. AWS provides a pricing calculator to help estimate the costs of using its services, including data transfer costs, based on your specific usage patterns and needs.
Direct Cost

--

Indirect Cost
No items found.
Best Practices for
Availability Zone

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Amazon Web Services