Skip to content

describe_availability_zones

describe_availability_zones(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    zone_names: Optional[ZoneNameStringList] = None,
    zone_ids: Optional[ZoneIdStringList] = None,
    all_availability_zones: Optional[Boolean] = None,
    dry_run: Optional[Boolean] = None,
    filters: Optional[FilterList] = None,
) -> DescribeAvailabilityZonesResult

Describes the Availability Zones, Local Zones, and Wavelength Zones that are available to you.

For more information about Availability Zones, Local Zones, and Wavelength Zones, see Regions and zones in the Amazon EC2 User Guide.

The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

Parameters:

  • zone_names (Optional[ZoneNameStringList], default: None ) –

    The names of the Availability Zones, Local Zones, and Wavelength Zones.

  • zone_ids (Optional[ZoneIdStringList], default: None ) –

    The IDs of the Availability Zones, Local Zones, and Wavelength Zones.

  • all_availability_zones (Optional[Boolean], default: None ) –

    Include all Availability Zones, Local Zones, and Wavelength Zones regardless of your opt-in status.

    If you do not use this parameter, the results include only the zones for the Regions where you have chosen the option to opt in.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • filters (Optional[FilterList], default: None ) –

    The filters.

    • group-long-name - The long name of the zone group for the Availability Zone (for example, US West (Oregon) 1), the Local Zone (for example, for Zone group us-west-2-lax-1, it is US West (Los Angeles), or the Wavelength Zone (for example, for Zone group us-east-1-wl1, it is US East (Verizon).

    • group-name - The name of the zone group for the Availability Zone (for example, us-east-1-zg-1), the Local Zone (for example, us-west-2-lax-1), or the Wavelength Zone (for example, us-east-1-wl1).

    • message - The Zone message.

    • opt-in-status - The opt-in status (opted-in | not-opted-in | opt-in-not-required).

    • parent-zone-id - The ID of the zone that handles some of the Local Zone and Wavelength Zone control plane operations, such as API calls.

    • parent-zone-name - The ID of the zone that handles some of the Local Zone and Wavelength Zone control plane operations, such as API calls.

    • region-name - The name of the Region for the Zone (for example, us-east-1).

    • state - The state of the Availability Zone, the Local Zone, or the Wavelength Zone (available | unavailable | constrained).

    • zone-id - The ID of the Availability Zone (for example, use1-az1), the Local Zone (for example, usw2-lax1-az1), or the Wavelength Zone (for example, us-east-1-wl1-bos-wlz-1).

    • zone-name - The name of the Availability Zone (for example, us-east-1a), the Local Zone (for example, us-west-2-lax-1a), or the Wavelength Zone (for example, us-east-1-wl1-bos-wlz-1).

    • zone-type - The type of zone (availability-zone | local-zone | wavelength-zone).

Raises:

Examples:

To describe your Availability Zones This example describes the Availability Zones that are available to you. The response includes Availability Zones only for the current region.

>>> client.describe_availability_zones()
Source code in docs_src/capo_ec2/_services/ec2.py
def describe_availability_zones(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    zone_names: Optional[
        "capo_ec2.types.zone_name_string_list.ZoneNameStringList"
    ] = None,
    zone_ids: Optional[
        "capo_ec2.types.zone_id_string_list.ZoneIdStringList"
    ] = None,
    all_availability_zones: Optional["capo_ec2.types.boolean.Boolean"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
) -> "capo_ec2.types.describe_availability_zones_result.DescribeAvailabilityZonesResult":
    """<p>Describes the Availability Zones, Local Zones, and Wavelength Zones that are available to you.</p> <p>For more information about Availability Zones, Local Zones, and Wavelength Zones, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html">Regions and zones</a> in the <i>Amazon EC2 User Guide</i>.</p> <note> <p>The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.</p> </note>

    Args:
        zone_names: <p>The names of the Availability Zones, Local Zones, and Wavelength Zones.</p>
        zone_ids: <p>The IDs of the Availability Zones, Local Zones, and Wavelength Zones.</p>
        all_availability_zones: <p>Include all Availability Zones, Local Zones, and Wavelength Zones regardless of your opt-in status.</p> <p>If you do not use this parameter, the results include only the zones for the Regions where you have chosen the option to opt in.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        filters: <p>The filters.</p> <ul> <li> <p> <code>group-long-name</code> - The long name of the zone group for the Availability Zone (for example, <code>US West (Oregon) 1</code>), the Local Zone (for example, for Zone group <code>us-west-2-lax-1</code>, it is <code>US West (Los Angeles)</code>, or the Wavelength Zone (for example, for Zone group <code>us-east-1-wl1</code>, it is <code>US East (Verizon)</code>.</p> </li> <li> <p> <code>group-name</code> - The name of the zone group for the Availability Zone (for example, <code>us-east-1-zg-1</code>), the Local Zone (for example, <code>us-west-2-lax-1</code>), or the Wavelength Zone (for example, <code>us-east-1-wl1</code>).</p> </li> <li> <p> <code>message</code> - The Zone message.</p> </li> <li> <p> <code>opt-in-status</code> - The opt-in status (<code>opted-in</code> | <code>not-opted-in</code> | <code>opt-in-not-required</code>).</p> </li> <li> <p> <code>parent-zone-id</code> - The ID of the zone that handles some of the Local Zone and Wavelength Zone control plane operations, such as API calls.</p> </li> <li> <p> <code>parent-zone-name</code> - The ID of the zone that handles some of the Local Zone and Wavelength Zone control plane operations, such as API calls.</p> </li> <li> <p> <code>region-name</code> - The name of the Region for the Zone (for example, <code>us-east-1</code>).</p> </li> <li> <p> <code>state</code> - The state of the Availability Zone, the Local Zone, or the Wavelength Zone (<code>available</code> | <code>unavailable</code> | <code>constrained</code>).</p> </li> <li> <p> <code>zone-id</code> - The ID of the Availability Zone (for example, <code>use1-az1</code>), the Local Zone (for example, <code>usw2-lax1-az1</code>), or the Wavelength Zone (for example, <code>us-east-1-wl1-bos-wlz-1</code>).</p> </li> <li> <p> <code>zone-name</code> - The name of the Availability Zone (for example, <code>us-east-1a</code>), the Local Zone (for example, <code>us-west-2-lax-1a</code>), or the Wavelength Zone (for example, <code>us-east-1-wl1-bos-wlz-1</code>).</p> </li> <li> <p> <code>zone-type</code> - The type of zone (<code>availability-zone</code> | <code>local-zone</code> | <code>wavelength-zone</code>).</p> </li> </ul>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe your Availability Zones
        This example describes the Availability Zones that are available to you. The response includes Availability Zones only for the current region.

        >>> client.describe_availability_zones()
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.describe_availability_zones_request.DescribeAvailabilityZonesRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.describe_availability_zones_result.DescribeAvailabilityZonesResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_availability_zones

        output, http_response = (
            capo_ec2._operations.amazon_ec2.describe_availability_zones.describe_availability_zones(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeAvailabilityZones")
    )
    input_: capo_ec2.types.describe_availability_zones_request.DescribeAvailabilityZonesRequest = {}
    if zone_names is not None:
        input_["zone_names"] = zone_names
    if zone_ids is not None:
        input_["zone_ids"] = zone_ids
    if all_availability_zones is not None:
        input_["all_availability_zones"] = all_availability_zones
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if filters is not None:
        input_["filters"] = filters

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output