CodePipeline + ECS deploy: deregister, drain, stop?

0

hi everyone,

I've got a CodePipeline + ECS question: we have a pipeline configured to do source --> build --> deploy that uses in the final step an Amazon ECS Deploy action provider like so:

Enter image description here

My expectation, from reading on the internet (https://stackoverflow.com/questions/75137347/aws-ecs-does-not-drain-connections-or-remove-tasks-from-target-group-before-stop and https://garbe.io/blog/2020/03/04/deep-dive-ecs-deployment/), is that when a new deployment happens in ECS, that it should:

  • deregister the old task
  • drain the old tasks... then
  • stop the old tasks

but when I'm seeing is that my containers are getting a "stop" message first... then deregister happens... then draining happens, which is problematic for our JVM's because the stop command / message tells the JVM to start shutting down... but we haven't drained the connections yet.

Anyone have any experience / tips for getting drain + degister happening well before a stop message is issued to the containers?

2 Respostas
0

Hi, if you want to have good control of what happens at JVM shutdown triggered by ECS to drain your sessions and do other things for a clean shutdown, you should insert shutdown hooks in your JVM config.

See https://www.baeldung.com/jvm-shutdown-hooks

With such hooks in place, you can do what you need: wait for existing sessions to complete, etc. before proceeding to effective shutdown

Best,

Didier

profile pictureAWS
ESPECIALISTA
respondido há 10 meses
0

yeah, that doesn't really help... the application I have is constantly receiving new HTTP requests.... I need ECS to stop sending requests / drain connections... THEN tell the JVM after all the connections are drained to stop...

Am I wrong that the ECS process should be 1) deregister, 2) drain, 3) shutdown?

profile picture
AJ
respondido há 10 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas