HealthCheckConfig

class aws_cdk.aws_servicediscovery.HealthCheckConfig(*, failure_threshold=None, resource_path=None, type=None)

Bases: object

Settings for an optional Amazon Route 53 health check.

If you specify settings for a health check, AWS Cloud Map associates the health check with all the records that you specify in DnsConfig. Only valid with a PublicDnsNamespace.

Parameters:
  • failure_threshold (Union[int, float, None]) – The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current status of the endpoint from unhealthy to healthy or vice versa. Default: 1

  • resource_path (Optional[str]) – The path that you want Route 53 to request when performing health checks. Do not use when health check type is TCP. Default: ‘/’

  • type (Optional[HealthCheckType]) – The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. Cannot be modified once created. Supported values are HTTP, HTTPS, and TCP. Default: HTTP

ExampleMetadata:

lit=aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts infused

Example:

import aws_cdk as cdk
import aws_cdk as servicediscovery

app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")

namespace = servicediscovery.HttpNamespace(stack, "MyNamespace",
    name="MyHTTPNamespace"
)

service1 = namespace.create_service("NonIpService",
    description="service registering non-ip instances"
)

service1.register_non_ip_instance("NonIpInstance",
    custom_attributes={"arn": "arn:aws:s3:::mybucket"}
)

service2 = namespace.create_service("IpService",
    description="service registering ip instances",
    health_check=cdk.aws_servicediscovery.HealthCheckConfig(
        type=servicediscovery.HealthCheckType.HTTP,
        resource_path="/check"
    )
)

service2.register_ip_instance("IpInstance",
    ipv4="54.239.25.192"
)

app.synth()

Attributes

failure_threshold

The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current status of the endpoint from unhealthy to healthy or vice versa.

Default:

1

resource_path

The path that you want Route 53 to request when performing health checks.

Do not use when health check type is TCP.

Default:

‘/’

type

The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy.

Cannot be modified once created. Supported values are HTTP, HTTPS, and TCP.

Default:

HTTP