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.
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.
Operating System and version as reported by $PSVersionTable.OS: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
PowerShell version as reported by $PSVersionTable.PSEdition: Core
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.
$PSVersionTable.OS
: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64$PSVersionTable.PSEdition
: Core