title: AWS ECS: Force redeployment on new latest image in ECR
body: <p>I know that there are already countless questions in this direction, but unfortunately I was not able to find the right answer yet. If a post already exists, please just share the link here.</p>
  
  <p>I have several gitlab CI / CD pipelines. The first pipeline uses Terraform to build the complete infrastructure for an ECS cluster based on Fargate. The second / third pipeline creates nightly builds of the frontend and the backend and pushes the Docker Image with the tag "latest" into the ECR of the (staging) AWS account.</p>
  
  <p>What I now want to achieve is that the corresponding ECS tasks are redeloyed so that the latest Docker images are used. I actually thought that there is a way to do this via CloudWatch Events or whatsoever, but I don't find a really good starting point here. A workaround would be to install the AWS CLI in the CI / CD pipeline and then do a service update with "force new deployment". But that doesn't seem very elegant to me. Is there any better way here?</p>
  
  <p>Conditions:</p>
  
  <ul>
  <li>The solution must be fully automated (either in AWS or in gitlab CI / CD)</li>
  <li>Switching to AWS CodePipeline is out of discussion</li>
  <li>Ideally as close as possible to AWS standards. I would like to avoid extensive lambda functions that perform numerous actions due to their maintainability.</li>
  </ul>
  
  <p>Thanks a lot!</p>