AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Specifying AWS Regions

There are two ways to specify the AWS region to use when running AWS CLI commands, the -Region common parameter, or the Set-AWSDefaultRegion command.

Most AWS cmdlets fail if you do not specify a region. The exceptions are cmdlets for Amazon S3, Amazon SES, and AWS Identity and Access Management (IAM ).

In the absence of a specified region, Amazon S3 and Amazon SES use US East (N. Virginia).

Amazon SES and IAM are services that do not require a region to be specified.

To specify the region for a single AWS command

Add the -Region parameter to your command, such as:

PS C:\> Get-EC2Image -Region us-west-1

To set a default region for all AWS CLI commands in the session

From the PowerShell command prompt, type the following command:

PS C:\> Set-DefaultAWSRegion -Region us-west-1

Note

This setting persists only for the current session. To apply the setting to all of your PowerShell sessions, add this command to your PowerShell profile as you did for the Import-Module command.

To view the current default region for all AWS CLI commands

From the PowerShell command prompt, type the following command:

PS C:\> Get-DefaultAWSRegion

Region                Name                                IsShellDefault
----------            ----                                --------------
us-west-1             US West (N. California)             True

To clear the current default region for all AWS CLI commands

From the PowerShell command prompt, type the following command:

PS C:\> Clear-DefaultAWSRegion

To view a list of all available AWS regions

From the PowerShell command prompt, type the following command. Note that the third column identifies which region is the default for your current session.

PS C:\> Get-AWSRegion

Region         Name                      IsShellDefault
------         ----                      --------------
us-east-1      US East (Virginia)        False
us-west-1      US West (N. California)   False
us-west-2      US West (Oregon)          True
eu-west-1      EU West (Ireland)         False
eu-central-1   EU Central (Frankfurt)    False
ap-northeast-1 Asia Pacific (Tokyo)      False
ap-northeast-2 Asia Pacific (Seoul)      False
ap-south-1     Asia Pacific (Mumbai)     False
ap-southeast-1 Asia Pacific (Singapore)  False
ap-southeast-2 Asia Pacific (Sydney)     False
sa-east-1      South America (Sao Paulo) False