Search code examples
amazon-web-servicesamazon-ec2amazon-ecsaws-fargateamazon-ecr

How to tag new version of an image, when deploying to ECR on AWS?


I wanted to run my docker image in AWS Fargate, so I followed this simple tutorial. Basically, I created an image on my computer and pushed it to the ECR. The tutorial (and AWS "Push commands" cheat sheet as well) suggests to tag the image as latest.

So I did, I tagged it as "latest", I pushed it to ECR, I created the Cluster and Task and successfully run this image in Fargate. But now I'm confused, because I fixed something in my image and would like to deploy new version. How should I tag the new image?

Should I rename the previous image, and the new one should be "latest" again? All tutorial I found a teaching how to deploy first image to the ECR. But I can't find anything that would show how to deploy new versions?

Thanks,


Solution

  • You don't have to rename the previous image, though you should if you want to keep it. Tagging something as latest when there is another image that is latest will replace the old image with the new. Any new instances of you task in ECS will pick up the new image, but ECS will not automatically replace existing tasks. You have to manually do that (obviously you can do it programmatically).

    Please keep in mind that tutorials like this are not always designed for production workloads. They are designed to get you working. This is not the best way to manage ECS task updates.