Search code examples
amazon-web-servicesamazon-ecsamazon-ecraws-event-bridge

AWS Event Bridge Scheduler: how ECS Task "latest" works?


Let me explain myself: if i create an Scheduler which invokes an ECS Tasks every night, and i click "latest" instead of putting a specific ARN... Event Bridge takes the current latest image and always uses that or everytime the cron is activated Event Bridge re-asks for the latest image to the ECR?


Solution

  • EventBridge doesn't look at ECR at all. It certainly doesn't store any specific information about a docker image in ECR. All it is doing it telling ECS to deploy a task, and to use the image in ECR with a specific tag as part of that task. If you change what image the "latest" tag points to in ECR, then the next time ECS starts a task it will pull the new "latest" image.

    However, you should be aware that caching of the docker image can occur in ECS, especially if you are deploying to EC2 instead of Fargate. In that case the EC2 instance might have the "latest" image cached, and might not go back to ECR and get a new version of "latest".