aws-cdk-lib.aws_elasticloadbalancing.HealthCheck

interface HealthCheck

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancing.HealthCheck
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancing#HealthCheck
Javasoftware.amazon.awscdk.services.elasticloadbalancing.HealthCheck
Pythonaws_cdk.aws_elasticloadbalancing.HealthCheck
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancing » HealthCheck

Describe the health check to a load balancer.

Example

declare const vpc: ec2.IVpc;
const lb = new elb.LoadBalancer(this, 'LB', {
  vpc,
  internetFacing: true,
  healthCheck: {
    port: 80,
  },
});

declare const myAutoScalingGroup: autoscaling.AutoScalingGroup;
lb.addTarget(myAutoScalingGroup);
lb.addListener({
  externalPort: 80,
});

Properties

NameTypeDescription
portnumberWhat port number to health check on.
healthyThreshold?numberAfter how many successful checks is an instance considered healthy.
interval?DurationNumber of seconds between health checks.
path?stringWhat path to use for HTTP or HTTPS health check (must return 200).
protocol?LoadBalancingProtocolWhat protocol to use for health checking.
timeout?DurationHealth check timeout.
unhealthyThreshold?numberAfter how many unsuccessful checks is an instance considered unhealthy.

port

Type: number

What port number to health check on.


healthyThreshold?

Type: number (optional, default: 2)

After how many successful checks is an instance considered healthy.


interval?

Type: Duration (optional, default: Duration.seconds(30))

Number of seconds between health checks.


path?

Type: string (optional, default: "/")

What path to use for HTTP or HTTPS health check (must return 200).

For SSL and TCP health checks, accepting connections is enough to be considered healthy.


protocol?

Type: LoadBalancingProtocol (optional, default: Automatic)

What protocol to use for health checking.

The protocol is automatically determined from the port if it's not supplied.


timeout?

Type: Duration (optional, default: Duration.seconds(5))

Health check timeout.


unhealthyThreshold?

Type: number (optional, default: 5)

After how many unsuccessful checks is an instance considered unhealthy.