Show / Hide Table of Contents

Class HealthCheck

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

Inheritance
System.Object
HealthCheck
Implements
IHealthCheck
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public class HealthCheck : Object, IHealthCheck
Syntax (vb)
Public Class HealthCheck
    Inherits Object
    Implements 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

Constructors

HealthCheck()

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.

Constructors

HealthCheck()

public HealthCheck()

Properties

Command

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

public string[] Command { get; set; }
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.

public Duration Interval { get; set; }
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.

public Nullable<double> Retries { get; set; }
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.

public Duration StartPeriod { get; set; }
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.

public Duration Timeout { get; set; }
Property Value

Duration

Remarks

You may specify between 2 and 60 seconds.

Default: Duration.seconds(5)

Implements

IHealthCheck
Back to top Generated by DocFX