Search code examples
amazon-web-servicescommand-line-interfaceaws-clialpine-linux

UnrecognizedClientException error when authenticating on aws-cli


When I pull a clean Alphine Linux Docker image, install aws-cli on it and try to authenticate myself with aws ecr get-authorization-token --region eu-central-1 I keep getting the following error:

An error occurred (UnrecognizedClientException) when calling the GetAuthorizationToken operation: The security token included in the request is invalid.

I've already checked the timezone which seem to be okay, and the command works properly on my local machine.

These are the commands I run to set up aws-cli: apk add --update python python-dev py-pip pip install awscli --upgrade export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Is there something obvious I'm missing?


Solution

  • It was an access issue after all! Turns out that if you create a new IAM user with full admin access it can't by default access the ECR registry you created using a different account. Using the IAM credentials from that other account resolved the issue.