5

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!

3
  • 3
    Did you run the aws configure using sudo too? Commented Jul 2, 2020 at 16:41
  • 1
    That was the fix! I must need more coffee this morning, can't believe I overlooked that. Thank you!
    – Roger
    Commented Jul 2, 2020 at 16:49
  • Added answer. Glad I could help you :) Commented Jul 2, 2020 at 16:55

2 Answers 2

16

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.

3
  • 2
    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.sock
    – jspinella
    Commented Nov 18, 2022 at 1:33
  • Both relevant and useful answers, thank you
    – Grilla99
    Commented Feb 23, 2023 at 11:32
  • I lost hours until I finally fount this, Thank you very much! Commented yesterday
1

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

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.
    – Community Bot
    Commented Jan 11 at 4:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.