<p>If task definition is using "latest" as image tag in container definition,to update ecs service in order to pull new image from ECR with "latest" tag. You can simply do Force new deployment 
aws ecs update-service --cluster  --service  --force-new-deployment --profile  </p>

<p>All though using "latest" tag for deployment is not good practice</p>

CC BY-SA 4.0
2020-04-15T07:02:31.413Z
2020-04-15T07:02:31.413Z
Ashwini Gaddagi
<p>Options are:</p>

<ol>
<li>Use CodeBuild to push the new image. Make sure the task definition is using the "latest" tag. You'll need to force the deployment of the task definition to pick the new image.</li>
<li>Use CodePipeline to update ECS. It will automatically generate a new task definition revision with the new image and deploy it.</li>
</ol>

CC BY-SA 4.0
2019-04-30T23:41:43.947Z
2019-04-30T23:41:43.947Z
aromero
<p>I have an ECS cluster/service/task definition using an image from my ECR repository.</p>

<p>Let's say I update the image with a new version, will ECS pick the changes automatically?</p>

<ol>
<li>Do I need to modify the task definition?</li>
<li>Do I need to somehow reload/restart the task(s)?</li>
</ol>

<p>My goal is to automate the deployment to ECS. I'm not sure if using CodeBuild to build and push the new image to ECR is enough, or if I need something else (codepipeline?) to deploy changes to ECS. </p>

<p>Note: task definition is using "latest" image tag, new images update that tag in ECR.</p>

<docker><amazon-ecs><docker-registry>
Update ECS task definition with new image from ECR
aromero
# Update ECS task definition with new image from ECR

(Asked by: username_0 on 2019-04-28)

I have an ECS cluster/service/task definition using an image from my ECR repository.

Let's say I update the image with a new version, will ECS pick the changes automatically?

1. Do I need to modify the task definition?
2. Do I need to somehow reload/restart the task(s)?

My goal is to automate the deployment to ECS. I'm not sure if using CodeBuild to build and push the new image to ECR is enough, or if I need something else (codepipeline?) to deploy changes to ECS.

Note: task definition is using "latest" image tag, new images update that tag in ECR.

**Tags:** docker, amazon-ecs, docker-registry


---

## 2 answers

### Answer by username_0 on 2019-04-30. Score: 5 | Accepted answer

Options are:

1. Use CodeBuild to push the new image. Make sure the task definition is using the "latest" tag. You'll need to force the deployment of the task definition to pick the new image.
2. Use CodePipeline to update ECS. It will automatically generate a new task definition revision with the new image and deploy it.


---

### Answer by username_1 on 2020-04-15. Score: 4

If task definition is using "latest" as image tag in container definition,to update ecs service in order to pull new image from ECR with "latest" tag. You can simply do Force new deployment
aws ecs update-service --cluster --service --force-new-deployment --profile

All though using "latest" tag for deployment is not good practice


---

