Sometimes you need to retag an existing AWS ECR (Elastic container registry) image to the latest in order to deploy it as the latest.
Use Power shell for these commands
1. Get a Specific Image from ECR by Digest
$Image = Get-ECRImageBatch -ImageId @{ imageDigest="sha256:5cf0bd5fa566c49bba44e9fab18bf340bff5f3ef224217a6f13e43321ce9" } -RepositoryName jagdev-poc/service
2. Extract the Image Manifest
$Manifest = $Image.Images[0].ImageManifest
3. Re-tag the Image with "latest"
Write-ECRImage -RepositoryName jagdev-poc/service -ImageManifest $Manifest -ImageTag latest
4. List All Images in the Repository
Get-ECRImage -RepositoryName jagdev-poc/service