Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Web Service PowerShell Credentials setup Errors

I am trying to set up my AWS on my local machine through windows PowerShell, it gives me the following error message;

    PS C:\> Set-AWSCredentials -AccessKey {AAAAAAAAAAAAAAA} -SecretKey {AAAAAAAAAAAAA} -Stor
eAs {default}
Set-AWSCredentials : Cannot evaluate parameter 'AccessKey' because its argument is specified as a script block and
there is no input. A script block cannot be evaluated without input.
At line:1 char:31
+ Set-AWSCredentials -AccessKey {AAAAAAAAAAAAAAA} -SecretKey {AAAAAAAAAAAA ...
+                               ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Set-AWSCredentials], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Amazon.PowerShell.Common.SetCredentialsCmdlet

And my Powershell Version is following;

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1

Anyone knows what the problem is?

Thanks

like image 852
Terry Zhang Avatar asked Feb 07 '23 04:02

Terry Zhang


1 Answers

It looks like you need to drop the brackets from your code, the documentation from amazon that comes up first in google includes them for some reason but if you check out http://docs.aws.amazon.com/powershell/latest/reference/items/Set-AWSCredentials.html and the examples near the bottom you'll see that the function is really expecting them in a string just like any other powershell cmdlet.

Set-AWSCredentials -AccessKey AAAAAAAAAAAAAAA -SecretKey AAAAAAAAAAAAA -StoreAs default

Should do the trick for you (if there are spaces in anything make sure to wrap the string in quotes)

like image 181
Mike Garuccio Avatar answered Feb 09 '23 00:02

Mike Garuccio