Skip to content

Instantly share code, notes, and snippets.

@leite08
Last active April 16, 2024 03:00
Show Gist options
  • Save leite08/06c75a07808978ed36a33f6a20e6452c to your computer and use it in GitHub Desktop.
Save leite08/06c75a07808978ed36a33f6a20e6452c to your computer and use it in GitHub Desktop.
AWS ECR - add tag to an image by tag
# This script adds a tag to an already tag ECR Image
ECR_REPO=...
CURR_TAG=...
NEW_TAG=latest
# Can replace imageTag="$CURR_TAG" by imageDigest="sha256:..." if the image doesn't have a tag
MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPO --image-ids imageTag="$CURR_TAG" --output text --query 'images[].imageManifest')
aws ecr put-image --repository-name $ECR_REPO --image-tag $NEW_TAG --image-manifest "$MANIFEST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment