0

Calling Get-Ec2Instance returns:

Get-Ec2Instance : No credentials specified or obtained from persisted/shell defaults.

I did however added the credentials file under C:\Users\{user name}\.aws directory

And when I call Get-AWSCredential -ListProfileDetail I get the expected result:

ProfileName StoreTypeName ProfileLocation

default SharedCredentialsFile C:\Users{user name}.aws\credentials

Any idea?

Thanks

1 Answer 1

0

How did you create the existing credential file? I use the following:

Set-AWSCredential -AccessKey "YourAccessKey" -SecretKey "YourSecretKey" -StoreAs "MyCredential"
Get-EC2Instance -Credential (Get-AWSCredential "MyCredential") -Region ap-east-1

I'm not sure why they do it this way, but saving the credential to a variable doesn't work for me, and gives me the error you're seeing:

PS C:\> $AWScred = Get-AWSCredential -ProfileName "MyCredential"
PS C:\> Get-EC2Instance -Credential $AWSCred

get-ec2instance : No credentials specified or obtained from persisted/shell defaults.

My credential type is NetSDKCredentialsFile though, which is encrypted and saves to C:\Users\username\AppData\Local\AWSToolkit\RegisteredAccounts.json.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .