HealthCheck

class aws_cdk.aws_elasticloadbalancingv2.HealthCheck(*, enabled=None, healthy_http_codes=None, healthy_threshold_count=None, interval=None, path=None, port=None, protocol=None, timeout=None, unhealthy_threshold_count=None)

Bases: object

Properties for configuring a health check.

Parameters
  • enabled (Optional[bool]) – 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. Default: - Determined automatically.

  • healthy_http_codes (Optional[str]) – 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”).

  • healthy_threshold_count (Union[int, float, None]) – 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. Default: 5 for ALBs, 3 for NLBs

  • interval (Optional[Duration]) – The approximate number of seconds between health checks for an individual target. Default: Duration.seconds(30)

  • path (Optional[str]) – The ping path destination where Elastic Load Balancing sends health check requests. Default: /

  • port (Optional[str]) – The port that the load balancer uses when performing health checks on the targets. Default: ‘traffic-port’

  • protocol (Optional[Protocol]) – 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. Default: HTTP for ALBs, TCP for NLBs

  • timeout (Optional[Duration]) – The amount of time, in seconds, during which no response from a target means a failed health check. 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

  • unhealthy_threshold_count (Union[int, float, None]) – 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. Default: 2

Attributes

enabled

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.

Default
  • Determined automatically.

Return type

Optional[bool]

healthy_http_codes

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”).

Return type

Optional[str]

healthy_threshold_count

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.

Default

5 for ALBs, 3 for NLBs

Return type

Union[int, float, None]

interval

The approximate number of seconds between health checks for an individual target.

Default

Duration.seconds(30)

Return type

Optional[Duration]

path

The ping path destination where Elastic Load Balancing sends health check requests.

Default

/

Return type

Optional[str]

port

The port that the load balancer uses when performing health checks on the targets.

Default

‘traffic-port’

Return type

Optional[str]

protocol

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.

Default

HTTP for ALBs, TCP for NLBs

Return type

Optional[Protocol]

timeout

The amount of time, in seconds, during which no response from a target means a failed health check.

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

Return type

Optional[Duration]

unhealthy_threshold_count

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.

Default

2

Return type

Union[int, float, None]