Hi,
I've tried a few times now on different computers over a longer period, to setup AWS in powershell using the Initialize cmdlet. But it never really sticks - as in, it works for the current session (Get-EC2Instance returns data) but doesn't persist onto new powershell instances. I finally make it work each time by looking up the documentation and finding that I can put in an AWSCredential named "default", which then sticks.
When troubleshooting this, I go to the location AWS Powershell stores persisted credentials, which according to this page should be at C:\Users\<user>\.aws\
- but that directory doesn't exist after an Initialize-AWSDefaultConfiguration
. Even if I create it, it doesn't get any content on reruns of the cmdlet.
Using procmon from Sysinternals, I've discovered a backing store file for Get-AWSCredential
(and Set-
) at this location: %LocalAppdata%\AWSToolkit
. Shouldn't the docs specify this directory instead?
This directory contains a JSON file with all the details needed - making me believe the .aws
directory is outdated?
This works for me (order does not seem to matter):
Set-AWSCredential -StoreAs default -AccessKey <..some access key..>
Initialize-AWSDefaultConfiguration -Region <..my region..>
After this, the JSON file in %LocalAppdata%\AWSToolkit
contains both my region and credentials. Subsequent sessions will run Get-EC2Instance
without error.
This does not work for me:
Initialize-AWSDefaultConfiguration -Region <..my region..>
It creates the JSON file in %LocalAppdata%\AWSToolkit
, but it only contains my region - it does not contain the credentials I supplied to Initialize-AWSDefaultConfiguration
.