Show / Hide Table of Contents

Interface IHealthCheck

The health check command and associated configuration parameters for the container.

Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public interface IHealthCheck
Syntax (vb)
Public Interface IHealthCheck
Remarks

ExampleMetadata: infused

Examples
Vpc vpc;
SecurityGroup securityGroup;

var queueProcessingFargateService = new QueueProcessingFargateService(this, "Service", new QueueProcessingFargateServiceProps {
    Vpc = vpc,
    MemoryLimitMiB = 512,
    Image = ContainerImage.FromRegistry("test"),
    HealthCheck = new HealthCheck {
        Command = new [] { "CMD-SHELL", "curl -f http://localhost/ || exit 1" },
        // the properties below are optional
        Interval = Duration.Minutes(30),
        Retries = 123,
        StartPeriod = Duration.Minutes(30),
        Timeout = Duration.Minutes(30)
    }
});

Synopsis

Properties

Command

A string array representing the command that the container runs to determine if it is healthy.

Interval

The time period in seconds between each health check execution.

Retries

The number of times to retry a failed health check before the container is considered unhealthy.

StartPeriod

The optional grace period within which to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

Timeout

The time period in seconds to wait for a health check to succeed before it is considered a failure.

Properties

Command

A string array representing the command that the container runs to determine if it is healthy.

string[] Command { get; }
Property Value

System.String[]

Remarks

The string array must start with CMD to execute the command arguments directly, or CMD-SHELL to run the command with the container's default shell.

For example: [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ]

Interval

The time period in seconds between each health check execution.

virtual Duration Interval { get; }
Property Value

Duration

Remarks

You may specify between 5 and 300 seconds.

Default: Duration.seconds(30)

Retries

The number of times to retry a failed health check before the container is considered unhealthy.

virtual Nullable<double> Retries { get; }
Property Value

System.Nullable<System.Double>

Remarks

You may specify between 1 and 10 retries.

Default: 3

StartPeriod

The optional grace period within which to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

virtual Duration StartPeriod { get; }
Property Value

Duration

Remarks

You may specify between 0 and 300 seconds.

Default: No start period

Timeout

The time period in seconds to wait for a health check to succeed before it is considered a failure.

virtual Duration Timeout { get; }
Property Value

Duration

Remarks

You may specify between 2 and 60 seconds.

Default: Duration.seconds(5)

Back to top Generated by DocFX