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개 답변
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
전문가
답변함 10달 전
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
답변함 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠