Tag archive: ECR

Amazon ECR – Adding a tag to an image after it’s already pushed

The steps are taken from http://docs.aws.amazon.com/AmazonECR/latest/userguide/retag-aws-cli.html. The issue I ran into is the wrong regions are selected. This is fixed with the –region param.

This is useful for adding tags to your :latest image. For example, QA looks at :latest, but my prod service looks for image :prod. I’ll also add a tag for the prod deployment date.


MY_MANIFEST=$(aws ecr batch-get-image --repository-name REPO_NAME --image-ids imageTag=latest --region us-west-2 --query images[].imageManifest --output text)

aws ecr put-image --repository-name REPO_NAME --image-tag NEW_TAG_NAME --image-manifest "$MY_MANIFEST" --region us-west-2

AWS ECR error – RepositoryNotFoundException

The Error

The AWS ECR cli does not switch regions, even when requesting a different get-login.


 aws ecr get-login –-registry-ids 191499206908  --region us-west-2
 // do login

 aws ecr describe-repositories
 // returns results of us-west-1, even though we signed in using us-west-2
 
 aws ecr  batch-get-image --repository-name  --image-ids imageTag=latest
 An error occurred (RepositoryNotFoundException) when calling the BatchGetImage operation: The repository with name '' does not exist in the registry with id ''