UnrecognizedClientException error when authenticating on aws-cli
In my case, my ~/.aws/credentials
file had an old aws_session_token
that was not updated by the aws configure
CLI command. Once I opened the file with vi ~/.aws/credentials
and deleted the aws_session_token
entry, I no longer encountered the UnrecognizedClientException
. I'm guessing that the AWS CLI first gives priority to the aws_session_token
over the aws access key id
and aws secret access key
when running AWS CLI commands, if aws_session_token
is present in the ~/.aws/credentials
file.
You don't have permission to access those resources until you get permission to aws-cli
, for that you can use the below steps.
Log into your AWS account, click on your account name, select my security credentials, click on access keys and download the credentials
Open your PowerShell
as administrator and follow the commands.
$ aws configure
$ AWS Access Key ID [****************E5TA]=xxxxxxxxxx
$ AWS Secret Access Key [****************7gNT]=xxxxxxxxxxxxxx
My issue was caused by the fact that I had inactivated my access key in the AWS IAM Management Console earlier as part of an exercise I was doing. Once I reactivated it, the problem was resolved.
(Make sure you're in the right AWS region, too.)
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.