Skip to content

describe_regions async

describe_regions(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    region_names: Optional[RegionNameStringList] = None,
    all_regions: Optional[Boolean] = None,
    dry_run: Optional[Boolean] = None,
    filters: Optional[FilterList] = None,
) -> DescribeRegionsResult

Describes the Regions that are enabled for your account, or all Regions.

For a list of the Regions supported by Amazon EC2, see Amazon EC2 service endpoints.

For information about enabling and disabling Regions for your account, see Specify which Amazon Web Services Regions your account can use in the Amazon Web Services Account Management Reference 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:

  • region_names (Optional[RegionNameStringList], default: None ) –

    The names of the Regions. You can specify any Regions, whether they are enabled and disabled for your account.

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

    Indicates whether to display all Regions, including Regions that are disabled for your account.

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

    • endpoint - The endpoint of the Region (for example, ec2.us-east-1.amazonaws.com).

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

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

Raises:

Examples:

To describe your regions This example describes all the regions that are available to you.

>>> await client.describe_regions()
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_regions(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    region_names: Optional[
        "capo_ec2.types.region_name_string_list.RegionNameStringList"
    ] = None,
    all_regions: 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_regions_result.DescribeRegionsResult":
    """<p>Describes the Regions that are enabled for your account, or all Regions.</p> <p>For a list of the Regions supported by Amazon EC2, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-endpoints.html">Amazon EC2 service endpoints</a>.</p> <p>For information about enabling and disabling Regions for your account, see <a href="https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html">Specify which Amazon Web Services Regions your account can use</a> in the <i>Amazon Web Services Account Management Reference 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:
        region_names: <p>The names of the Regions. You can specify any Regions, whether they are enabled and disabled for your account.</p>
        all_regions: <p>Indicates whether to display all Regions, including Regions that are disabled for your account.</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>endpoint</code> - The endpoint of the Region (for example, <code>ec2.us-east-1.amazonaws.com</code>).</p> </li> <li> <p> <code>opt-in-status</code> - The opt-in status of the Region (<code>opt-in-not-required</code> | <code>opted-in</code> | <code>not-opted-in</code>).</p> </li> <li> <p> <code>region-name</code> - The name of the Region (for example, <code>us-east-1</code>).</p> </li> </ul>

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

    Examples:
        To describe your regions
        This example describes all the regions that are available to you.

        >>> await client.describe_regions()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_regions_request.DescribeRegionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_regions_result.DescribeRegionsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_regions

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_regions.async_describe_regions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeRegions")
    )
    input_: capo_ec2.types.describe_regions_request.DescribeRegionsRequest = {}
    if region_names is not None:
        input_["region_names"] = region_names
    if all_regions is not None:
        input_["all_regions"] = all_regions
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if filters is not None:
        input_["filters"] = filters

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output