3

I am an issue that either I do not understand well or something weird happening with aws ecs service.

I update my code, create a new docker image and push it to be deployed using ECS. The issue is, when the task definition does not changes, the code does not get deployed, even though the image in ECR got updated. How can get my code deployed then? I am assuming that when the image has changed, the services is run the already registered tasks which should pull the image right?

Example of commands I run

aws ecs register-task-definition --cli-input-json file:///deploy/tasks/my-task-definition.json

aws ecs update-service --service my-service --cluster my-clusdter --task-definition my-task-defintion

The first time I run these commands, the code is deployed, if I update my code, push the new image to the Registry, then run these commands, my code does not get deployed.

anyavacy
  • 1,618
  • 5
  • 21
  • 43

2 Answers2

2

The updates are pulled every time your ECR gets updated. Double check the way you're confirming the updated version.

Axblert
  • 556
  • 4
  • 19
0

In order to update your container with the updated images, you have to revised your task definition with the latest image from the repository, then your service should be updated with the new task definition you've defined.

It looks like you are on the right track, but I assume that json file is revising your task definition with the same image. If this is the case, you can just change the tag for the image to :latest so that you can run the same commands with the same json every single time.

Serey
  • 10,173
  • 2
  • 17
  • 22
  • 1
    I am using a custom tag and then pushing a new image with the same tag. So no new task definition required because the tag is still the same, but the image got updated. It seems like it's not checking for the updated version of that image – Mukarram Ali Jan 15 '20 at 11:02