AWS Tools for Windows PowerShell
Command Reference

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.

Synopsis

Sets a default AWS region system name (e.g. us-west-2, eu-west-1 etc) into the shell variable $StoredAWSRegion. AWS cmdlets will use the value of this variable to satisfy their -Region parameter if the parameter is not specified.

Syntax

Set-DefaultAWSRegion
-Region <Object>
-ProfileLocation <String>

Description

Sets a default AWS region into the shell environment, accessible as $StoredAWSRegion.

Parameters

-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs). When supplied the cmdlet will attempt to read the default region to be used from the credential file's default profile.If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?212
Accept pipeline input?False
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.If the Region parameter is supplied the cmdlet ignores the ProfileLocation parameter.
Required?False
Position?211
Accept pipeline input?True (ByValue, ByPropertyName)

Inputs

System.Object
You can pipe a Object object to this cmdlet for the Region parameter.

Outputs

None
This cmdlet does not generate any output.

Examples

Example 1

PS C:\>Set-DefaultAWSRegion -Region us-west-2
Sets the default region for all cmdlets in the current shell to 'us-west-2' (the parameter name can be omitted for brevity). Once a shell default has been set you can override the default by using the -Region parameter with the specific cmdlet(s) as required.

Supported Version

AWS Tools for PowerShell: 2.x.y.z