PS C:\Users\Test123> (Get-EC2Region).RegionName
Get-EC2Region : AWS was not able to validate the provided access credentials
At line:1 char:2
+ (Get-EC2Region).RegionName
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Amazon.PowerShe...EC2RegionCmdlet:GetEC2RegionCmdlet) [Get-EC2Region], InvalidOperationException
+ FullyQualifiedErrorId : Amazon.EC2.AmazonEC2Exception,Amazon.PowerShell.Cmdlets.EC2.GetEC2RegionCmdlet
PS C:\Users\Test123> aws --version
aws-cli/2.10.1 Python/3.9.11 Windows/10 exe/AMD64 prompt/off
PS C:\Users\Test123>
I tried to remove my cli credentials and profile and reconfigured but still not working:
Remove-AWSCredentialProfile -ProfileName myaccount -Confirm:$false