DescribeRegionsCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, DescribeRegionsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DescribeRegionsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DescribeRegionsRequest
  RegionNames: [ // RegionNameStringList
    "STRING_VALUE",
  ],
  AllRegions: true || false,
  DryRun: true || false,
  Filters: [ // FilterList
    { // Filter
      Name: "STRING_VALUE",
      Values: [ // ValueStringList
        "STRING_VALUE",
      ],
    },
  ],
};
const command = new DescribeRegionsCommand(input);
const response = await client.send(command);
// { // DescribeRegionsResult
//   Regions: [ // RegionList
//     { // Region
//       OptInStatus: "STRING_VALUE",
//       RegionName: "STRING_VALUE",
//       Endpoint: "STRING_VALUE",
//     },
//   ],
// };

Example Usage

 There was an error loading the code editor. Retry

DescribeRegionsCommand Input

See DescribeRegionsCommandInput for more details

Parameter
Type
Description
AllRegions
boolean | undefined

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

DryRun
boolean | undefined

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
Filter[] | undefined

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

RegionNames
string[] | undefined

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

DescribeRegionsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Regions
Region[] | undefined

Information about the Regions.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.