'AWS environment variables does not work with ECR get-login

Am I configuring environment variables for the default user, but it does not work with aws ecr get-login why?

> export AWS_ACCESS_KEY_ID=SOMEID
> export AWS_SECRET_ACCESS_KEY=SOMEID
> sudo aws ecr get-login --no-include-email --region eu-west-1

This gives the error:

Unable to locate credentials. You can configure credentials by running "aws configure".

Using AWS configure resolves the issue. However, I would like to use environment variables instead.

  • I can see the environment variables are set and correct using env


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source