aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

LoadBalancedFargateService: Add ability to specify Health Check path

Open EduardTheThird opened this issue 7 years ago • 6 comments

We are using LoadBalancedFargateService to generate some Fargate services.

Currently, the health check path defaults to root. "/" We need to set the health check path for each Fargate service.

Having the ability to specify or change the health check path would be greatly be appreciated! Is there a workaround available for this?

Thanks! 🐈

EduardTheThird avatar Apr 23 '19 10:04 EduardTheThird

You can have a look at my template for creating a basic Fargate cluster: https://github.com/markusl/cdk-fargate-docker-starter/blob/master/lib/cdk-fargate-starter-docker-stack.ts

You can easily specify custom health check:

      .addTargets(..., {
        // ...
        healthCheck: {
          path: '/health-check',
        },
      });

markusl avatar Apr 28 '19 18:04 markusl

But you are creating the resources manually. The request is to add health checks to the LoadBalancedFargateService L2 construct. This would really be great.

hoegertn avatar May 09 '19 07:05 hoegertn

Closing due to old data (see comments in #2704).

If closing was incorrect, feel free to reopen.

😸

NGL321 avatar Oct 12 '19 00:10 NGL321

I could not find any solution other than creating all resources manually, defeating the purpose of LoadBalancedFargateService. #2704 was closed, but the solution isn't clear

danilofuchs avatar Mar 10 '20 12:03 danilofuchs

I found I was able to access the health check settings via:

const server = new ApplicationLoadBalancedFargateService(...)
server.targetGroup.configureHealthCheck({
      path: "/health",
      interval: Duration.seconds(120),
      unhealthyThresholdCount: 5,
      ... etc
}); 

jwmonroe-outschool avatar Apr 30 '20 04:04 jwmonroe-outschool

There is the example in the official docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.HealthCheck.html

ealain avatar Aug 30 '23 09:08 ealain