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
-Scope <VariableScope>

Description

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

Note: The regions available for tab completion to the -Region parameter were those known at the time this module was built. Regions launched subsequent to the build will not be listed for tab completion but can still be used by simply entering the region system name.

Parameters

-Scope <VariableScope>
This parameter allows to specify the scope of the region configuration to set. For details about variables scopes see https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region 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?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-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)
AliasesRegionToCall

Outputs

None
This cmdlet does not generate any output.

Examples

Example 1

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