Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login to AWS from AWS Tools for Powershell

I'm trying to use AWS Tools from Powershell, but I don't know how to log in. So when I run a command I naturally get this error:

No credentials specified or obtained from persisted/shell defaults.

How do I login? I read the article at https://docs.aws.amazon.com/powershell/latest/userguide/specifying-your-aws-credentials.html, but it talks about public and private keys. I don't have those, I login to AWS from the web interface with my username and password (and also a token sent to my phone because I have MFA enabled).

Also, my user isn't allowed to create IAM users (it's a company policy and I can't override it).

like image 992
sashoalm Avatar asked Sep 01 '17 12:09

sashoalm


People also ask

How do I connect to AWS using PowerShell?

To use AWS programmatically from PowerShell, you need to generate your access keys. To do this, sign into the AWS console, and from the Services tab, select IAM under Security, Identity, & Compliance. From the left-hand side, select Users, and find the username you want to generate access keys for.

Can you use AWS CLI in PowerShell?

The AWS Tools for PowerShell let developers and administrators manage their AWS services and resources in the PowerShell scripting environment. Now you can manage your AWS resources with the same PowerShell tools you use to manage your Windows, Linux, and MacOS environments.

How do I find my AWS PowerShell version?

AWS releases new versions of the AWS Tools for PowerShell periodically to support new AWS services and features. To determine the version of the Tools that you have installed, run the Get-AWSPowerShellVersion cmdlet.

Where do I put AWS credentials in Windows?

By default, the credentials file is stored here: On Windows: C:\Users\ username \. aws\credentials.


1 Answers

If your IAM user account doesn't already have Access and Secret Keys you'll need to create them here.

http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey

Then create a profile

Writes a new (or updates existing) profile with name "myProfileName" in the encrypted SDK store file

Set-AWSCredential -AccessKey akey -SecretKey skey -StoreAs myProfileName

Checks the encrypted SDK credential store for the profile and then falls back to the shared credentials file in the default location

Set-AWSCredential -ProfileName myProfileName
like image 144
strongjz Avatar answered Nov 05 '22 02:11

strongjz