Class HealthCheck
Properties for configuring a health check.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.dll
Syntax (csharp)
public class HealthCheck : Object, IHealthCheck
Syntax (vb)
Public Class HealthCheck
Inherits Object
Implements IHealthCheck
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
var loadBalancedFargateService = new ApplicationLoadBalancedFargateService(this, "Service", new ApplicationLoadBalancedFargateServiceProps {
Cluster = cluster,
MemoryLimitMiB = 1024,
Cpu = 512,
TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
}
});
loadBalancedFargateService.TargetGroup.ConfigureHealthCheck(new HealthCheck {
Path = "/custom-health-path"
});
Synopsis
Constructors
HealthCheck() |
Properties
Enabled | Indicates whether health checks are enabled. |
HealthyGrpcCodes | GRPC code to use when checking for a successful response from a target. |
HealthyHttpCodes | HTTP code to use when checking for a successful response from a target. |
HealthyThresholdCount | The number of consecutive health checks successes required before considering an unhealthy target healthy. |
Interval | The approximate number of seconds between health checks for an individual target. |
Path | The ping path destination where Elastic Load Balancing sends health check requests. |
Port | The port that the load balancer uses when performing health checks on the targets. |
Protocol | The protocol the load balancer uses when performing health checks on targets. |
Timeout | The amount of time, in seconds, during which no response from a target means a failed health check. |
UnhealthyThresholdCount | The number of consecutive health check failures required before considering a target unhealthy. |
Constructors
HealthCheck()
public HealthCheck()
Properties
Enabled
Indicates whether health checks are enabled.
public Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
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.
Default: - Determined automatically.
HealthyGrpcCodes
GRPC code to use when checking for a successful response from a target.
public string HealthyGrpcCodes { get; set; }
Property Value
System.String
Remarks
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").
Default: - 12
HealthyHttpCodes
HTTP code to use when checking for a successful response from a target.
public string HealthyHttpCodes { get; set; }
Property Value
System.String
Remarks
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
The number of consecutive health checks successes required before considering an unhealthy target healthy.
public Nullable<double> HealthyThresholdCount { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
For Application Load Balancers, the default is 5. For Network Load Balancers, the default is 3.
Default: 5 for ALBs, 3 for NLBs
Interval
The approximate number of seconds between health checks for an individual target.
public Duration Interval { get; set; }
Property Value
Remarks
Default: Duration.seconds(30)
Path
The ping path destination where Elastic Load Balancing sends health check requests.
public string Path { get; set; }
Property Value
System.String
Remarks
Default: /
Port
The port that the load balancer uses when performing health checks on the targets.
public string Port { get; set; }
Property Value
System.String
Remarks
Default: 'traffic-port'
Protocol
The protocol the load balancer uses when performing health checks on targets.
public Nullable<Protocol> Protocol { get; set; }
Property Value
System.Nullable<Protocol>
Remarks
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.
Default: HTTP for ALBs, TCP for NLBs
Timeout
The amount of time, in seconds, during which no response from a target means a failed health check.
public Duration Timeout { get; set; }
Property Value
Remarks
For Application Load Balancers, the range is 2-60 seconds and the default is 5 seconds. For Network Load Balancers, this is 10 seconds for TCP and HTTPS health checks and 6 seconds for HTTP health checks.
Default: Duration.seconds(5) for ALBs, Duration.seconds(10) or Duration.seconds(6) for NLBs
UnhealthyThresholdCount
The number of consecutive health check failures required before considering a target unhealthy.
public Nullable<double> UnhealthyThresholdCount { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
For Application Load Balancers, the default is 2. For Network Load Balancers, this value must be the same as the healthy threshold count.
Default: 2