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

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

aws configure set aws_access_key_id $AWS_KEY
aws configure set aws_secret_access_key $AWS_SECRET
aws configure set default.region us-east-1
aws configure set default.output json

login="$(aws ecr get-login --no-include-email --region us-east-1)"
${login}

docker build -f Dockerfile_prod --cache-from app -t app .

Tags:

Misc Example