Skip to content

Data Source: awsRegions

Provides information about AWS Regions. Can be used to filter regions i.e., by Opt-In status or only regions enabled for current account. To get details like endpoint and description of each region the data source can be combined with the awsRegion data source.

Example Usage

Enabled AWS Regions:

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsRegions.DataAwsRegions(this, "current", {});

All the regions regardless of the availability

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsRegions.DataAwsRegions(this, "current", {
  allRegions: true,
});

To see regions that are filtered by "notOptedIn", the allRegions argument needs to be set to true or no results will be returned.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsRegions.DataAwsRegions(this, "current", {
  allRegions: true,
  filter: [
    {
      name: "opt-in-status",
      values: ["not-opted-in"],
    },
  ],
});

Argument Reference

The following arguments are supported:

  • allRegions - (Optional) If true the source will query all regions regardless of availability.

  • filter - (Optional) Configuration block(s) to use as filters. Detailed below.

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 describe-regions AWS CLI 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:

  • id - Identifier of the current partition (e.g., aws in AWS Commercial, awsCn in AWS China).
  • names - Names of regions that meets the criteria.