TJB
TJB

Reputation: 3856

Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY

Just configured the AWS CLI on my computer with my AWS Access and Secret Key. When I try to use the AWS CLI though it gives me this error.

Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY

I went to ~/.aws/config, and sure enough those credentials are there, including the AWS Secret Key, so I'm not sure why its squawking at me.

Upvotes: 29

Views: 51285

Answers (6)

Marcos Vile
Marcos Vile

Reputation: 65

For authentication to work, you need to create the ~/.aws/credentials file with your AWS credentials in the following format:

[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If you are using the command line, use the $ aws configure command to reconfigure your credentials and restart the session.

The big trick is to reconfigure and restart the session.

Upvotes: 0

Daniel Marques
Daniel Marques

Reputation: 1403

That happened to me because I only had export the variables AWS_ACCESS_KEY_ID and AWS_DEFAULT_REGION, but forgot to export the AWS_SECRET_ACCESS_KEY.

All in one command:

export AWS_ACCESS_KEY_ID=<XXXXXXXXXXX> && \
export AWS_SECRET_ACCESS_KEY=<XXXXXXXXXXX> && \
export AWS_DEFAULT_REGION=<XXXXXX>

Upvotes: 2

Jitendra Panwar
Jitendra Panwar

Reputation: 1

I ran with this problem and I did rerun the same workflow yml again and again but changes were never actually occurs. Finally, I had to remove existing workflow from GitHub and re-initiate/pushed yml configuration file again. Worked for me. Thank You!

Upvotes: 0

Guilherme Louzada
Guilherme Louzada

Reputation: 165

If you are using MacOS, this may be caused because you set other credentials in the environmental variables.

Setting the new credentials to the environmental variables might solve your problem.

To do so run this in the terminal:

export AWS_ACCESS_KEY_ID=X
export AWS_SECRET_ACCESS_KEY=Y
export AWS_DEFAULT_REGION=REGION

Substitute X, Y, and REGION with the values corresponding to your application.

Source documentation: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html

Upvotes: 1

saku
saku

Reputation: 3616

For anyone who is having the same problem - this is solution that worked for me:

If you are on Windows - check if you don't have AWS_ACCESS_KEY_ID set in your system variables. AWS CLI uses something called configuration provider chain - and environment variables take precedence over configuration file. In my case somehow I had only set AWS_ACCESS_KEY_ID thus the error message.

Upvotes: 16

Carlos Rodriguez
Carlos Rodriguez

Reputation: 630

You should have this file ~/.aws/credentials and the contents should be in the following format:

[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Upvotes: 23

Related Questions