Search code examples
amazon-web-servicesnginxamazon-ecsaws-fargate

ECS cluster service restart which depend on other service


I have 3 services(comm,bot,nginx) in ECS Fargate cluster with respective task definations,when bot or comm service restarts other nginx service should be restarted automatically or else our bot app won't work, we solving this problem by manually restarting Nginx service when bot or comm service restarts on thier own.Is there a way to restart service Nginx service automatic when other bot or comm service in a fargate cluster restart on thier own.


Solution

  • You can have a look at ECS Event Bridge events. ECS sends a lot of ECS related events to EB. You can setup EB rule to the even of interest and trigger a lambda function, for example. Then the function would verify the event, and restart your other service/task if needed using AWS SDK.