HealthCheck

class aws_cdk.aws_appmesh.HealthCheck

Bases: object

Contains static factory methods for creating health checks for different protocols.

ExampleMetadata:

infused

Example:

# mesh: appmesh.Mesh
vpc = ec2.Vpc(self, "vpc")
namespace = cloudmap.PrivateDnsNamespace(self, "test-namespace",
    vpc=vpc,
    name="domain.local"
)
service = namespace.create_service("Svc")
node = mesh.add_virtual_node("virtual-node",
    service_discovery=appmesh.ServiceDiscovery.cloud_map(service),
    listeners=[appmesh.VirtualNodeListener.http(
        port=8081,
        health_check=appmesh.HealthCheck.http(
            healthy_threshold=3,
            interval=Duration.seconds(5),  # minimum
            path="/health-check-path",
            timeout=Duration.seconds(2),  # minimum
            unhealthy_threshold=2
        )
    )],
    access_log=appmesh.AccessLog.from_file_path("/dev/stdout")
)

Methods

abstract bind(scope, *, default_port=None)

Called when the AccessLog type is initialized.

Can be used to enforce mutual exclusivity with future properties

Parameters:
  • scope (Construct) –

  • default_port (Union[int, float, None]) – Port for Health Check interface. Default: - no default port is provided

Return type:

HealthCheckConfig

Static Methods

classmethod grpc(*, healthy_threshold=None, interval=None, timeout=None, unhealthy_threshold=None)

Construct a GRPC health check.

Parameters:
  • healthy_threshold (Union[int, float, None]) – The number of consecutive successful health checks that must occur before declaring listener healthy. Default: 2

  • interval (Optional[Duration]) – The time period between each health check execution. Default: Duration.seconds(5)

  • timeout (Optional[Duration]) – The amount of time to wait when receiving a response from the health check. Default: Duration.seconds(2)

  • unhealthy_threshold (Union[int, float, None]) – The number of consecutive failed health checks that must occur before declaring a listener unhealthy. Default: - 2

Return type:

HealthCheck

classmethod http(*, healthy_threshold=None, interval=None, path=None, timeout=None, unhealthy_threshold=None)

Construct a HTTP health check.

Parameters:
  • healthy_threshold (Union[int, float, None]) – The number of consecutive successful health checks that must occur before declaring listener healthy. Default: 2

  • interval (Optional[Duration]) – The time period between each health check execution. Default: Duration.seconds(5)

  • path (Optional[str]) – The destination path for the health check request. Default: /

  • timeout (Optional[Duration]) – The amount of time to wait when receiving a response from the health check. Default: Duration.seconds(2)

  • unhealthy_threshold (Union[int, float, None]) – The number of consecutive failed health checks that must occur before declaring a listener unhealthy. Default: - 2

Return type:

HealthCheck

classmethod http2(*, healthy_threshold=None, interval=None, path=None, timeout=None, unhealthy_threshold=None)

Construct a HTTP2 health check.

Parameters:
  • healthy_threshold (Union[int, float, None]) – The number of consecutive successful health checks that must occur before declaring listener healthy. Default: 2

  • interval (Optional[Duration]) – The time period between each health check execution. Default: Duration.seconds(5)

  • path (Optional[str]) – The destination path for the health check request. Default: /

  • timeout (Optional[Duration]) – The amount of time to wait when receiving a response from the health check. Default: Duration.seconds(2)

  • unhealthy_threshold (Union[int, float, None]) – The number of consecutive failed health checks that must occur before declaring a listener unhealthy. Default: - 2

Return type:

HealthCheck

classmethod tcp(*, healthy_threshold=None, interval=None, timeout=None, unhealthy_threshold=None)

Construct a TCP health check.

Parameters:
  • healthy_threshold (Union[int, float, None]) – The number of consecutive successful health checks that must occur before declaring listener healthy. Default: 2

  • interval (Optional[Duration]) – The time period between each health check execution. Default: Duration.seconds(5)

  • timeout (Optional[Duration]) – The amount of time to wait when receiving a response from the health check. Default: Duration.seconds(2)

  • unhealthy_threshold (Union[int, float, None]) – The number of consecutive failed health checks that must occur before declaring a listener unhealthy. Default: - 2

Return type:

HealthCheck