Priya Rajput
Priya Rajput

Reputation: 101

AWS CLI does not use credentials set with environment variables

I have a simple Test.bat file that is as follows

set AWS_ACCESS_KEY=xxx
set AWS_ACCESS_KEY=yyy
set AWS_DEFAULT_REGION=us-west-1

aws ec2 describe-instances

When I run this batch file, it is listing the instances from my production account. When I checked my user profile location at C:\Users\testuser.aws , the credentials file has the accesss key and secret key of my production account.

My question is per the aws documentation (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) environment variables takes precedence over the credentials file. But why does this not work for me ? I would want the instances to be listed for the account specified in the bat file.

Thank you

Upvotes: 4

Views: 3516

Answers (1)

garnaat
garnaat

Reputation: 45906

The AWSCLI will look for the following environment variables:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
AWS_DEFAULT_PROFILE

It doesn't look like you are using the right env var names.

Upvotes: 3

Related Questions