aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
238 stars 79 forks source link

Get-EC2Region requires use of default region #45

Closed jrjespersen closed 5 years ago

jrjespersen commented 5 years ago

Using the Get-EC2Region cmdlet without previously setting/declaring a region results in an error.

Expected Behavior Get-EC2-Region should return a list of regions with enabled status.

Current Behavior Get-EC2-Region results in the error “Get-EC2Region : No region specified or obtained from persisted/shell defaults.”

Full error: get-ec2region : No region specified or obtained from persisted/shell defaults. At line:1 char:1

Possible Solution

As a workaround, using Set-AWSDefaultRegion does allow the cmdlet to execute. However, all other cmdlets I use allow the use of the -Region parameter without setting defaults.

Steps to Reproduce (for bugs)

Import-Module AWSPowerShell.NetCore Get-EC2Region -Region "us-east-1" -ProfileName "AWS CORP LAB" `

Context

I write functions and scripts that customers use that iterate over credential arrays and region arrays to perform actions in bulk. My code intentionally does not modify the user's shell/environment and does not expect that defaults are set.

There may also be a relation to the issue I'm submitting directly after this one (behavior between the -Region and -RegionName parameters).

Your Environment

Include as many relevant details about the environment where the bug was discovered.

matteo-prosperi commented 5 years ago

Duplicate of https://github.com/aws/aws-tools-for-powershell/issues/46