Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
AWS ECS: Force redeployment on new latest image in ECR

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.

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.

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?

Conditions:

  • The solution must be fully automated (either in AWS or in gitlab CI / CD)
  • Switching to AWS CodePipeline is out of discussion
  • Ideally as close as possible to AWS standards. I would like to avoid extensive lambda functions that perform numerous actions due to their maintainability.

Thanks a lot!

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Ok, for everybody who is interested in an answer. I solved it that way: I execute the following AWS CLI command in the CICD pipeline

aws ecs update-service --cluster <<cluster-name>> --service <<service-name>> --force-new-deployment --region <<region>>

Not the solution I was looking for but it works.

over 4 years ago · Santiago Trujillo Relatório

0

As a general comment it is not recommended to always push the same container tag because then rolling back to a previous version in case of failure becomes really difficult.

One suitable option would be to use git tags. Let's say you are deploying version v0.0.1 You can create a file app-version.tf which will contain the variable backend-version = v0.0.1 that you can reference on the task definition of the ecs service. Same thing can be done for the container creation using git describe.

So, you get a new task definition for every git tag and the possibility of rolling back just by changing a value in the terraform configuration.

over 4 years ago · Santiago Trujillo Relatório

0

It is beneficial to refer to images using either digests or unique immutable tags. After the pipeline pushes the image, it could:

  1. Grab the image's digest/unique tag
  2. Create a new revision of the task definition
  3. Trigger an ECS deployment with the new task definition.

As sgramo93 mentions, the big benefit is that rolling back your application can be done by deploying an older revision of the task definition.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda