The SpringBoot application is running as an ECS Task in a ECS Service of an AWS Fargate Cluster. The ECS Service is LoadBalanced as such the Tasks spawned by the Services are automatically registered to a target group.

I am able to call the Health endpoint via API Gateway => VPC Link => Network ELB => Application ELB => ECS Task, as shown below: Call from Postman

However, the HealthChecks seem to be failing and as such, the tasks are being deregistered continously resulting in totally unusable setup.

ECS Service Events

I have made sure to configure the HealthCheck of the Target Group point towards the right endpoint URL, as shown below: Health Check Settings

I also made sure that the Security Group that the Fargate Tasks belong in allows traffics from the Application Load Balancer, as shown below: Security Group for ECS Tasks

But somehow, the HealthChecks kept failing and the tasks are being deregistered, and I'm very confused!

Your help is much appreciated!


The problem actually is with the Health Check Intervals (30 seconds) and Threshold (2 checks) which is too frequent when the Task is just starting up and is unable to respond to the HTTP request.

So, I increased the interval and the threshold, and everything is fine now!