Show / Hide Table of Contents

Interface CfnTaskDefinition.IRestartPolicyProperty

You can enable a restart policy for each container defined in your task definition, to overcome transient failures faster and maintain task availability.

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

When you enable a restart policy for a container, Amazon ECS can restart the container if it exits, without needing to replace the task. For more information, see Restart individual containers in Amazon ECS tasks with container restart policies in the Amazon Elastic Container Service Developer Guide .

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-restartpolicy.html

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.ECS;

             var restartPolicyProperty = new RestartPolicyProperty {
                 Enabled = false,
                 IgnoredExitCodes = new [] { 123 },
                 RestartAttemptPeriod = 123
             };

Synopsis

Properties

Enabled

Specifies whether a restart policy is enabled for the container.

IgnoredExitCodes

A list of exit codes that Amazon ECS will ignore and not attempt a restart on.

RestartAttemptPeriod

A period of time (in seconds) that the container must run for before a restart can be attempted.

Properties

Enabled

Specifies whether a restart policy is enabled for the container.

object? Enabled { get; }
Property Value

object

Remarks

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-restartpolicy.html#cfn-ecs-taskdefinition-restartpolicy-enabled

Type union: either bool or IResolvable

IgnoredExitCodes

A list of exit codes that Amazon ECS will ignore and not attempt a restart on.

object? IgnoredExitCodes { get; }
Property Value

object

Remarks

You can specify a maximum of 50 container exit codes. By default, Amazon ECS does not ignore any exit codes.

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-restartpolicy.html#cfn-ecs-taskdefinition-restartpolicy-ignoredexitcodes

Type union: either (double)[] or IResolvable

RestartAttemptPeriod

A period of time (in seconds) that the container must run for before a restart can be attempted.

double? RestartAttemptPeriod { get; }
Property Value

double?

Remarks

A container can be restarted only once every restartAttemptPeriod seconds. If a container isn't able to run for this time period and exits early, it will not be restarted. You can set a minimum restartAttemptPeriod of 60 seconds and a maximum restartAttemptPeriod of 1800 seconds. By default, a container must run for 300 seconds before it can be restarted.

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-restartpolicy.html#cfn-ecs-taskdefinition-restartpolicy-restartattemptperiod

Back to top Generated by DocFX