How can I set AWS credentials in AWS PowerShell

Alan2 picture Alan2 · Nov 3, 2015 · Viewed 8.1k times · Source

I just downloaded the latest version of AWS Powershell and tried this: Before I don't remember any problem. Now I am getting this error message:

PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> Set-AWSCredentials -AccessKey xxxxxxxx -SecretKey xxxxxxx -StoreAs xxxx
Set-AWSCredentials : The term 'Set-AWSCredentials' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Set-AWSCredentials -AccessKey xxxxxxx -SecretKey xxxxx
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-AWSCredentials:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell>

Does anyone have any ideas what I might be doing wrong? Has some syntax changed again :-(

Thanks

Answer

Steve Roberts picture Steve Roberts · Nov 3, 2015

The tools install to a folder structure compliant with the auto-import support in PowerShell version 3 or higher, so Import-Module should not be needed.

It does however require that the PSModulePath update the installer performs takes effect, and we've noticed that on some systems you need to reboot after install.

Looking at PSModulePath you should see something like this (excuse wrapping):

PS C:\> ls env:PSModulePath | fl

Name  : PSModulePath
Value : C:\Users\userid\Documents\WindowsPowerShell\Modules;C:\Program
        Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

If so, try restarting your machine and then open a shell prompt and see if Set-AWSCredentials becomes available. If not, report back and we'll try and repro.