Aws-cli: Docker authentication to ECR registry in Milan region

Created on 25 Nov 2020  路  4Comments  路  Source: aws/aws-cli

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
I'm trying to authenticate Docker to ECR registry placed in Milan region (eu-south-1) but all I get is the following error

Error saving credentials: error storing credentials - err: exit status 1, out: error storing credentials - err: exit status 1, out:The stub received bad data.``

The command I use the following

aws ecr get-login-password --profile [profile_name] --region eu-south-1 | docker login --username AWS --password-stdin [aws_account_id].dkr.ecr.eu-south-1.amazonaws.com

The region for the account is enabled. If I specify another region (ie: eu-west-1) the login succeed.
I get the same error even using AWS PowerShell Tools so maybe the problem is not related to AWS CLI (v2)

SDK version number
aws-cli/2.0.7 Python/3.7.5 Windows/10 botocore/2.0.0dev11

Platform/OS/Hardware/Device
Windows 10 Pro (build 19041) and WSL2

To Reproduce (observed behavior)

aws ecr get-login-password --profile [profile_name] --region eu-south-1 | docker login --username AWS --password-stdin [aws_account_id].dkr.ecr.eu-south-1.amazonaws.com

Expected behavior

Login Succeeded

Logs/output
.

Additional context
By using another region the login succeed

duplicate ecr third-party

All 4 comments

Hi @n-dallacosta, sorry to hear of the issue!

This is likely the same issue as in https://github.com/aws/aws-cli/issues/5636. The authentication token can be of different lengths depending on the environment, and there is a known limitation of the Windows Credential Manager, which cannot support credentials greater than 2500 characters (see https://github.com/aws/aws-cli/issues/5636#issuecomment-709665379).

I found that the token for the region eu-south-1 (Milan) is about 2700 characters while for eu-west-1 (Ireland) is about 1900. Windows Credentials Manager has a limit of 2500 characters so that is the cause of the problem

Wow, that was a fast response, @n-dallacosta! Thanks for confirming. Since this is a known issue and tracked in https://github.com/aws/aws-cli/issues/5636, I'll close this now.

鈿狅笍COMMENT VISIBILITY WARNING鈿狅笍

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pawelkilian picture pawelkilian  路  3Comments

alexejk picture alexejk  路  3Comments

DrStrangepork picture DrStrangepork  路  3Comments

rahul003 picture rahul003  路  3Comments

motilevy picture motilevy  路  3Comments