GetAvailabilityZone

aws.getAvailabilityZone provides details about a specific availability zone (AZ) in the current region.

This can be used both to validate an availability zone given in a variable and to split the AZ name into its component parts of an AWS region and an AZ identifier letter. The latter may be useful e.g. for implementing a consistent subnet numbering scheme across several regions by mapping both the region and the subnet letter to network numbers.

This is different from the aws.getAvailabilityZones (plural) data source, which provides a list of the available zones.

Example Usage

Coming soon!

Coming soon!

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const config = new pulumi.Config();
const regionNumber = config.get("regionNumber") || {
    "ap-northeast-1": 5,
    "eu-central-1": 4,
    "us-east-1": 1,
    "us-west-1": 2,
    "us-west-2": 3,
};
const azNumber = config.get("azNumber") || {
    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.
const exampleAvailabilityZone = pulumi.output(aws.getAvailabilityZone({
    name: "eu-central-1a",
}, { async: true }));
// Create a VPC for the region associated with the AZ
const exampleVpc = new aws.ec2.Vpc("example", {
    cidrBlock: exampleAvailabilityZone.apply(exampleAvailabilityZone => (() => {
        throw "tf2pulumi error: NYI: call to cidrsubnet";
        return (() => { throw "NYI: call to cidrsubnet"; })();
    })()),
});
// Create a subnet for the AZ within the regional VPC
const exampleSubnet = new aws.ec2.Subnet("example", {
    cidrBlock: pulumi.all([exampleVpc.cidrBlock, exampleAvailabilityZone]).apply(([cidrBlock, exampleAvailabilityZone]) => (() => {
        throw "tf2pulumi error: NYI: call to cidrsubnet";
        return (() => { throw "NYI: call to cidrsubnet"; })();
    })()),
    vpcId: exampleVpc.id,
});

Using GetAvailabilityZone

function getAvailabilityZone(args: GetAvailabilityZoneArgs, opts?: InvokeOptions): Promise<GetAvailabilityZoneResult>
function  get_availability_zone(all_availability_zones=None, filters=None, name=None, state=None, zone_id=None, opts=None)
func GetAvailabilityZone(ctx *Context, args *GetAvailabilityZoneArgs, opts ...InvokeOption) (*GetAvailabilityZoneResult, error)
public static class GetAvailabilityZone {
    public static Task<GetAvailabilityZoneResult> InvokeAsync(GetAvailabilityZoneArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

AllAvailabilityZones bool

Set to true to include all Availability Zones and Local Zones regardless of your opt in status.

Filters List<GetAvailabilityZoneFilterArgs>

Configuration block(s) for filtering. Detailed below.

Name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

State string

A specific availability zone state to require. May be any of "available", "information" or "impaired".

ZoneId string

The zone ID of the availability zone to select.

AllAvailabilityZones bool

Set to true to include all Availability Zones and Local Zones regardless of your opt in status.

Filters []GetAvailabilityZoneFilter

Configuration block(s) for filtering. Detailed below.

Name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

State string

A specific availability zone state to require. May be any of "available", "information" or "impaired".

ZoneId string

The zone ID of the availability zone to select.

allAvailabilityZones boolean

Set to true to include all Availability Zones and Local Zones regardless of your opt in status.

filters GetAvailabilityZoneFilter[]

Configuration block(s) for filtering. Detailed below.

name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

state string

A specific availability zone state to require. May be any of "available", "information" or "impaired".

zoneId string

The zone ID of the availability zone to select.

all_availability_zones bool

Set to true to include all Availability Zones and Local Zones regardless of your opt in status.

filters List[GetAvailabilityZoneFilter]

Configuration block(s) for filtering. Detailed below.

name str

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

state str

A specific availability zone state to require. May be any of "available", "information" or "impaired".

zone_id str

The zone ID of the availability zone to select.

GetAvailabilityZone Result

The following output properties are available:

GroupName string

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.

Id string

The provider-assigned unique ID for this managed resource.

Name string
NameSuffix string

The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.

NetworkBorderGroup string

The name of the location from which the address is advertised.

OptInStatus string

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.

Region string

The 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.

State string
ZoneId string
AllAvailabilityZones bool
Filters List<GetAvailabilityZoneFilter>
GroupName string

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.

Id string

The provider-assigned unique ID for this managed resource.

Name string
NameSuffix string

The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.

NetworkBorderGroup string

The name of the location from which the address is advertised.

OptInStatus string

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.

Region string

The 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.

State string
ZoneId string
AllAvailabilityZones bool
Filters []GetAvailabilityZoneFilter
groupName string

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.

id string

The provider-assigned unique ID for this managed resource.

name string
nameSuffix string

The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.

networkBorderGroup string

The name of the location from which the address is advertised.

optInStatus string

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.

region string

The 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.

state string
zoneId string
allAvailabilityZones boolean
filters GetAvailabilityZoneFilter[]
group_name str

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.

id str

The provider-assigned unique ID for this managed resource.

name str
name_suffix str

The part of the AZ name that appears after the region name, uniquely identifying the AZ within its region.

network_border_group str

The name of the location from which the address is advertised.

opt_in_status str

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.

region str

The 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.

state str
zone_id str
all_availability_zones bool
filters List[GetAvailabilityZoneFilter]

Supporting Types

GetAvailabilityZoneFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

Values List<string>

Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

Name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

Values []string

Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

name string

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

values string[]

Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

name str

The name of the filter field. Valid values can be found in the EC2 DescribeAvailabilityZones API Reference.

values List[str]

Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.