ECS: Autoscaling scale down the wrong instance

0

Hello

We have a web application which start on demand algorithms. When a user start an algorithm, it starts a task in an ECS Cluster, which has a capacity provider configured to provide an EC2 to run the algorithm.

Here I have 2 issues :

  • When ECS detect that it needs to provide an EC2, 2 servers are scaled while only 1 task is startedCapacityProviderReservation

  • As we can see in the screenshot, after 15 min the capacity provider detects that it needs only 1 EC2, so it scale down one EC2, but sometimes, it kills the server on which the algorithm is running. Logs from amazon-ecs-agent on tail -f during the execution of the task :

level=info time=2022-11-17T13:20:40Z msg="Managed task at steady state" task="e4874c5693044ed08acbeb311c4919a5" knownStatus="RUNNING"
level=info time=2022-11-17T13:20:40Z msg="Managed task at steady state" task="e4874c5693044ed08acbeb311c4919a5" knownStatus="RUNNING"
Connection to 35.180.71.XXX closed by remote host.

Is there a way to provide only 1 EC2 when we start a task ?

Is ECS the right way to do these actions ?

Thank you, Valentin

질문됨 일 년 전259회 조회
1개 답변
0

Here are some ideas how you could manage these on-demand jobs better:

  • If you are just running the container to execute one time algorithm then AWS Batch might be better way for you to launch and manage those containers.
  • If you don't want implement AWS Batch and you like your current ECS setup. Then you should consider AWS Fargate with ECS. This would launch your on-demand Tasks as individual compute and you wouldn't need to manage EC2 capacity.
  • ECS also just launched new feature called scale-in protection. So you could tag the ECS Task running your algorythm as protected. This would prevent the capacity provider from scaling that specific EC2 instance down. You would have to implement this protection and removal of protection as part of your web service.
profile pictureAWS
전문가
Toni_S
답변함 일 년 전

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

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

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

관련 콘텐츠