An error occurred (InvalidSignatureException) when calling the GetAuthorizationToken operation - GCP + Gitlab

Hello all, I’m getting the current error message, when trying to get the password for my private ECR registry on my Gitlab pipeline:


aws configure set region ${AWS_CONFIG_REGION}
aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID}
aws configure set aws_secret_access_key ${AWS_CONFIG_SECRET}
aws ecr get-login-password --region us-east-1


An error occurred (InvalidSignatureException) when calling the GetAuthorizationToken operation: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
Error: Cannot perform an interactive login from a non TTY device

Funny part, if I ran this code with the same credentials on my local desktop or even accessing via SSH the Gitlab runner and running the same commands, on both cases it works perfectly. The issue happens only on the Gitlab pipeline.

What I’m using aws-cli/2.11.9, Python/3.11.2 and Linux/4.14.281-212.502.amzn2.x86_64.