interface HealthCheck
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.HealthCheck |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#HealthCheck |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.HealthCheck |
Python | aws_cdk.aws_elasticloadbalancingv2.HealthCheck |
TypeScript (source) | aws-cdk-lib » aws_elasticloadbalancingv2 » HealthCheck |
Properties for configuring a health check.
Example
declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', {
cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
command: ['command'],
entryPoint: ['entry', 'point'],
},
});
loadBalancedFargateService.targetGroup.configureHealthCheck({
path: "/custom-health-path",
});
Properties
Name | Type | Description |
---|---|---|
enabled? | boolean | Indicates whether health checks are enabled. |
healthy | string | GRPC code to use when checking for a successful response from a target. |
healthy | string | HTTP code to use when checking for a successful response from a target. |
healthy | number | The number of consecutive health checks successes required before considering an unhealthy target healthy. |
interval? | Duration | The approximate number of seconds between health checks for an individual target. |
path? | string | The ping path destination where Elastic Load Balancing sends health check requests. |
port? | string | The port that the load balancer uses when performing health checks on the targets. |
protocol? | Protocol | The protocol the load balancer uses when performing health checks on targets. |
timeout? | Duration | The amount of time, in seconds, during which no response from a target means a failed health check. |
unhealthy | number | The number of consecutive health check failures required before considering a target unhealthy. |
enabled?
Type:
boolean
(optional, default: Determined automatically.)
Indicates whether health checks are enabled.
If the target type is lambda, health checks are disabled by default but can be enabled. If the target type is instance or ip, health checks are always enabled and cannot be disabled.
healthyGrpcCodes?
Type:
string
(optional, default: 12)
GRPC code to use when checking for a successful response from a target.
You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5").
healthyHttpCodes?
Type:
string
(optional)
HTTP code to use when checking for a successful response from a target.
For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").
healthyThresholdCount?
Type:
number
(optional, default: 5 for ALBs, 3 for NLBs)
The number of consecutive health checks successes required before considering an unhealthy target healthy.
For Application Load Balancers, the default is 5. For Network Load Balancers, the default is 3.
interval?
Type:
Duration
(optional, default: 10 seconds if protocol is GENEVE
, 35 seconds if target type is lambda
, else 30 seconds)
The approximate number of seconds between health checks for an individual target.
Must be 5 to 300 seconds
path?
Type:
string
(optional, default: /)
The ping path destination where Elastic Load Balancing sends health check requests.
port?
Type:
string
(optional, default: 'traffic-port')
The port that the load balancer uses when performing health checks on the targets.
protocol?
Type:
Protocol
(optional, default: HTTP for ALBs, TCP for NLBs)
The protocol the load balancer uses when performing health checks on targets.
The TCP protocol is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The TLS, UDP, and TCP_UDP protocols are not supported for health checks.
timeout?
Type:
Duration
(optional, default: 6 seconds if the protocol is HTTP, 5 seconds if protocol is GENEVE
, 30 seconds if target type is lambda
, 10 seconds for TCP, TLS, or HTTPS)
The amount of time, in seconds, during which no response from a target means a failed health check.
Must be 2 to 120 seconds.
unhealthyThresholdCount?
Type:
number
(optional, default: 2)
The number of consecutive health check failures required before considering a target unhealthy.
For Application Load Balancers, the default is 2. For Network Load Balancers, this value must be the same as the healthy threshold count.