Class CfnContainerGroupDefinition.ContainerHealthCheckProperty
Instructions on when and how to check the health of a container in a container fleet.
Inheritance
Namespace: Amazon.CDK.AWS.GameLift
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ContainerHealthCheckProperty : Object, CfnContainerGroupDefinition.IContainerHealthCheckProperty
Syntax (vb)
Public Class ContainerHealthCheckProperty
Inherits Object
Implements CfnContainerGroupDefinition.IContainerHealthCheckProperty
Remarks
When health check properties are set in a container definition, they override any Docker health checks in the container image. For more information on container health checks, see HealthCheck command in the Amazon Elastic Container Service API .
The following example instructions tell the container to wait 100 seconds after launch before counting failed health checks, then initiate the health check command every 60 seconds. After issuing the health check command, wait 10 seconds for it to succeed. If it fails, retry the command 3 times before considering the container to be unhealthy.
{"Command": [ "CMD-SHELL", "ps cax | grep "processmanager" || exit 1" ], "Interval": 300, "Timeout": 30, "Retries": 5, "StartPeriod": 100 }
Part of: ContainerDefinition$HealthCheck
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.GameLift;
var containerHealthCheckProperty = new ContainerHealthCheckProperty {
Command = new [] { "command" },
// the properties below are optional
Interval = 123,
Retries = 123,
StartPeriod = 123,
Timeout = 123
};
Synopsis
Constructors
ContainerHealthCheckProperty() |
Properties
Command | A string array that specifies the command that the container runs to determine if it's healthy. |
Interval | The time period (in seconds) between each health check. |
Retries | The number of times to retry a failed health check before the container is considered unhealthy. |
StartPeriod | The optional grace period (in seconds) to give a container time to bootstrap before the first failed health check counts toward the number of retries. |
Timeout | The time period (in seconds) to wait for a health check to succeed before a failed health check is counted. |
Constructors
ContainerHealthCheckProperty()
public ContainerHealthCheckProperty()
Properties
Command
A string array that specifies the command that the container runs to determine if it's healthy.
public string[] Command { get; set; }
Property Value
System.String[]
Remarks
Interval
The time period (in seconds) between each health check.
public Nullable<double> Interval { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
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
The first run of the command does not count as a retry.
StartPeriod
The optional grace period (in seconds) to give a container time to bootstrap before the first failed health check counts toward the number of retries.
public Nullable<double> StartPeriod { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Timeout
The time period (in seconds) to wait for a health check to succeed before a failed health check is counted.
public Nullable<double> Timeout { get; set; }
Property Value
System.Nullable<System.Double>