RestartPolicyProperty Struct
You can enable a restart policy for each container defined in your task definition, to overcome transient failures faster and maintain task availability.
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 .
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const restartPolicyProperty: ecs.CfnTaskDefinition.RestartPolicyProperty = {
enabled: false,
ignoredExitCodes: [123],
restartAttemptPeriod: 123,
};
Properties
enabledboolean | IResolvableenabledtyping.Union[bool, IResolvable]enabledBooleanEnabledboolEnabledinterface{}#ignoredExitCodesnumber[] | IResolvableignored_exit_codestyping.Union[typing.List[int | float], IResolvable]ignoredExitCodesList<Number>IgnoredExitCodesdouble[]IgnoredExitCodesinterface{}#You can specify a maximum of 50 container exit codes. By default, Amazon ECS does not ignore any exit codes.
restartAttemptPeriodnumberrestart_attempt_periodint | floatrestartAttemptPeriodNumberRestartAttemptPerioddoubleRestartAttemptPeriod*float64#notes
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.