Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ECR trying to use Get-ECRLoginCommnad fails

I am new to AWS and I am trying to register an image on ECR on windows. To do that I am using PowerShell to connect to AWS.

Below is my version

PS C:\> aws --version

aws-cli/2.0.0 Python/3.7.5 Windows/10 botocore/2.0.0dev4

I used aws configure command to login. I went to users -> createdUser -> Security Credentials for Access key and Secret key.

When I use Get-ECRLoginCommand

PS C:\> Get-ECRLoginCommand

Get-ECRLoginCommand : 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.
At line:1 char:1
+ Get-ECRLoginCommand
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Amazon.PowerShe...inCommandCmdlet:GetECRLoginCommandCmdlet) [Get-ECRL
   oginCommand], InvalidOperationException
    + FullyQualifiedErrorId : Amazon.ECR.AmazonECRException,Amazon.PowerShell.Cmdlets.ECR.GetECRLoginCommandCmdlet  

Can someone please help me how to registry docker image on ECR?

like image 405
cubcoder00 Avatar asked Oct 21 '25 09:10

cubcoder00


1 Answers

Even on Windows,

it's easier to use push instructions on Linux and macOS.

you just need to install AWS CLI, docker, and set up AWS credentials.

Install AWS CLI version 2

msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

To confirm the installation

C:\> aws --version
aws-cli/2.2.43 Python/3.8.8 Windows/10 exe/AMD64 prompt/off

In AWS IAM, create user with the required role.

It's not recommended. I simply created a user with AdministratorAccess.

set up your AWS credentials

aws configure

AWS Access Key ID [None]: Access Key
AWS Secret Access Key [None]: Secret Key
Default region name [None]: us-west-2
Default output format [None]: json

Now, Authenticate the docker of the Amazon ECR registry

aws ecr get-login-password | docker login --username AWS --password-stdin YOUR-REGISTRY-URL

Login Succeeded

Finally, Pushing a Docker Image

docker build -t YOUR-BUILD-NAME .
docker tag YOUR-BUILD-NAME:latest YOUR-REGISTRY-URL/YOUR-BUILD-NAME:latest
docker push YOUR-REGISTRY-URL/YOUR-BUILD-NAME:latest
like image 93
shaell Avatar answered Oct 23 '25 08:10

shaell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!