Unable to authenticate my AWS credentials for ECR
Asked Answered
R

2

6

I have installed the latest versions of the aws-cli-2 and docker, as well as ran "aws configure" and entered my access key and secret key. I have also verified the aws.config is correct and showing the right region and output format. My credentials in AWS are admin. I keep getting the following error:

'''Unable to locate credentials. You can configure credentials by running "aws configure". Error: Cannot perform an interactive login from a non TTY device'''

Even though I have already ran 'aws configure.' I am running the commands prefixed with 'sudo' as well. Any thoughts?! Thank you for your time!

Rescind answered 2/7, 2020 at 16:39 Comment(3)
Did you run the aws configure using sudo too?Magistrate
That was the fix! I must need more coffee this morning, can't believe I overlooked that. Thank you!Rescind
Added answer. Glad I could help you :)Magistrate
M
17

The aws configure command was being run as the local user, whereas the ecr command was being run as sudo.

If you run commands as sudo it will not have access to your local users config, it will instead default to the root users.

Instead ensure all commands are run as the same user.

If you want to use the aws credentials file from the default location you can also specify the location via the AWS_CONFIG_FILE environment variable.

Magistrate answered 2/7, 2020 at 16:55 Comment(3)
and if you're trying to run as sudo because you got a permission denied error from Docker Daemon, running this might fix it: sudo chmod 666 /var/run/docker.sockFusee
Both relevant and useful answers, thank youPalmation
I lost hours until I finally fount this, Thank you very much!Carilla
N
1

run -----> sudo chmod 666 /var/run/docker.sock in ubuntu

Nolen answered 9/1 at 5:37 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Understudy

© 2022 - 2024 — McMap. All rights reserved.