Interface CfnDaemonTaskDefinition.DaemonContainerDefinitionProperty
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CfnDaemonTaskDefinition.DaemonContainerDefinitionProperty.Jsii$Proxy
- Enclosing class:
CfnDaemonTaskDefinition
Daemon container definitions describe the containers that run as part of a daemon task on container instances managed by capacity providers.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;
DaemonContainerDefinitionProperty daemonContainerDefinitionProperty = DaemonContainerDefinitionProperty.builder()
.image("image")
.name("name")
// the properties below are optional
.command(List.of("command"))
.cpu(123)
.dependsOn(List.of(ContainerDependencyProperty.builder()
.condition("condition")
.containerName("containerName")
.build()))
.entryPoint(List.of("entryPoint"))
.environment(List.of(KeyValuePairProperty.builder()
.name("name")
.value("value")
.build()))
.environmentFiles(List.of(EnvironmentFileProperty.builder()
.type("type")
.value("value")
.build()))
.essential(false)
.firelensConfiguration(FirelensConfigurationProperty.builder()
.options(Map.of(
"optionsKey", "options"))
.type("type")
.build())
.healthCheck(HealthCheckProperty.builder()
.command(List.of("command"))
.interval(123)
.retries(123)
.startPeriod(123)
.timeout(123)
.build())
.interactive(false)
.linuxParameters(LinuxParametersProperty.builder()
.capabilities(KernelCapabilitiesProperty.builder()
.add(List.of("add"))
.drop(List.of("drop"))
.build())
.devices(List.of(DeviceProperty.builder()
.containerPath("containerPath")
.hostPath("hostPath")
.permissions(List.of("permissions"))
.build()))
.initProcessEnabled(false)
.tmpfs(List.of(TmpfsProperty.builder()
.size(123)
// the properties below are optional
.containerPath("containerPath")
.mountOptions(List.of("mountOptions"))
.build()))
.build())
.logConfiguration(LogConfigurationProperty.builder()
.logDriver("logDriver")
// the properties below are optional
.options(Map.of(
"optionsKey", "options"))
.secretOptions(List.of(SecretProperty.builder()
.name("name")
.valueFrom("valueFrom")
.build()))
.build())
.memory(123)
.memoryReservation(123)
.mountPoints(List.of(MountPointProperty.builder()
.containerPath("containerPath")
.readOnly(false)
.sourceVolume("sourceVolume")
.build()))
.privileged(false)
.pseudoTerminal(false)
.readonlyRootFilesystem(false)
.repositoryCredentials(RepositoryCredentialsProperty.builder()
.credentialsParameter("credentialsParameter")
.build())
.restartPolicy(RestartPolicyProperty.builder()
.enabled(false)
.ignoredExitCodes(List.of(123))
.restartAttemptPeriod(123)
.build())
.secrets(List.of(SecretProperty.builder()
.name("name")
.valueFrom("valueFrom")
.build()))
.startTimeout(123)
.stopTimeout(123)
.systemControls(List.of(SystemControlProperty.builder()
.namespace("namespace")
.value("value")
.build()))
.ulimits(List.of(UlimitProperty.builder()
.hardLimit(123)
.name("name")
.softLimit(123)
.build()))
.user("user")
.workingDirectory("workingDirectory")
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final classAn implementation forCfnDaemonTaskDefinition.DaemonContainerDefinitionProperty -
Method Summary
Modifier and TypeMethodDescriptionbuilder()The command that's passed to the container.default NumbergetCpu()The number ofcpuunits reserved for the container.default ObjectThe dependencies defined for container startup and shutdown.The entry point that's passed to the container.default ObjectThe environment variables to pass to a container.default ObjectA list of files containing the environment variables to pass to a container.default ObjectIf theessentialparameter of a container is marked astrue, and that container fails or stops for any reason, all other containers that are part of the task are stopped.default ObjectThe FireLens configuration for the container.default ObjectAn object representing a container health check.getImage()The image used to start the container.default ObjectWhen this parameter istrue, you can deploy containerized applications that requirestdinor attyto be allocated.default ObjectThe Linux-specific options that are applied to the container, such as Linux KernelCapabilities.default ObjectThe log configuration for the container.default NumberThe amount (in MiB) of memory to present to the container.default NumberThe soft limit (in MiB) of memory to reserve for the container.default ObjectThe mount points for data volumes in your container.getName()The name of the container.default ObjectWhen this parameter is true, the container is given elevated privileges on the host container instance (similar to therootuser).default ObjectWhen this parameter istrue, a TTY is allocated.default ObjectWhen this parameter is true, the container is given read-only access to its root file system.default ObjectThe repository credentials for private registry authentication.default ObjectReturns union: eitherIResolvableorCfnDaemonTaskDefinition.RestartPolicyPropertydefault ObjectThe secrets to pass to the container.default NumberTime duration (in seconds) to wait before giving up on resolving dependencies for a container.default NumberTime duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.default ObjectA list of namespaced kernel parameters to set in the container.default ObjectA list ofulimitsto set in the container.default StringgetUser()The user to use inside the container.default StringThe working directory to run commands inside the container in.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getImage
The image used to start the container.This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either
repository-url/image:tagorrepository-url/image@digest.- See Also:
-
getName
The name of the container.Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.
- See Also:
-
getCommand
The command that's passed to the container.- See Also:
-
getCpu
The number ofcpuunits reserved for the container.- See Also:
-
getDependsOn
The dependencies defined for container startup and shutdown.A container can contain multiple dependencies on other containers in a task definition.
Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.ContainerDependencyProperty>- See Also:
-
getEntryPoint
The entry point that's passed to the container.- See Also:
-
getEnvironment
The environment variables to pass to a container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.KeyValuePairProperty>- See Also:
-
getEnvironmentFiles
A list of files containing the environment variables to pass to a container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.EnvironmentFileProperty>- See Also:
-
getEssential
If theessentialparameter of a container is marked astrue, and that container fails or stops for any reason, all other containers that are part of the task are stopped.Returns union: either
BooleanorIResolvable- See Also:
-
getFirelensConfiguration
The FireLens configuration for the container.This is used to specify and configure a log router for container logs. For more information, see Custom log routing in the Amazon Elastic Container Service Developer Guide.
Returns union: either
IResolvableorCfnDaemonTaskDefinition.FirelensConfigurationProperty- See Also:
-
getHealthCheck
An object representing a container health check.Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image (such as those specified in a parent image or from the image's Dockerfile). This configuration maps to the
HEALTHCHECKparameter of docker run. The Amazon ECS container agent only monitors and reports on the health checks specified in the task definition. Amazon ECS does not monitor Docker health checks that are embedded in a container image and not specified in the container definition. Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image. You can view the health status of both individual containers and a task with the DescribeTasks API operation or when viewing the task details in the console. The health check is designed to make sure that your containers survive agent restarts, upgrades, or temporary unavailability. Amazon ECS performs health checks on containers with the default that launched the container instance or the task. The following describes the possiblehealthStatusvalues for a container:HEALTHY-The container health check has passed successfully.UNHEALTHY-The container health check has failed.UNKNOWN-The container health check is being evaluated, there's no container health check defined, or Amazon ECS doesn't have the health status of the container.
The following describes the possible
healthStatusvalues based on the container health checker status of essential containers in the task with the following priority order (high to low):UNHEALTHY-One or more essential containers have failed their health check.UNKNOWN-Any essential container running within the task is in anUNKNOWNstate and no other essential containers have anUNHEALTHYstate.HEALTHY-All essential containers within the task have passed their health checks.
Consider the following task health example with 2 containers.
- If Container1 is
UNHEALTHYand Container2 isUNKNOWN, the task health isUNHEALTHY. - If Container1 is
UNHEALTHYand Container2 isHEALTHY, the task health isUNHEALTHY. - If Container1 is
HEALTHYand Container2 isUNKNOWN, the task health isUNKNOWN. - If Container1 is
HEALTHYand Container2 isHEALTHY, the task health isHEALTHY.
Consider the following task health example with 3 containers.
- If Container1 is
UNHEALTHYand Container2 isUNKNOWN, and Container3 isUNKNOWN, the task health isUNHEALTHY. - If Container1 is
UNHEALTHYand Container2 isUNKNOWN, and Container3 isHEALTHY, the task health isUNHEALTHY. - If Container1 is
UNHEALTHYand Container2 isHEALTHY, and Container3 isHEALTHY, the task health isUNHEALTHY. - If Container1 is
HEALTHYand Container2 isUNKNOWN, and Container3 isHEALTHY, the task health isUNKNOWN. - If Container1 is
HEALTHYand Container2 isUNKNOWN, and Container3 isUNKNOWN, the task health isUNKNOWN. - If Container1 is
HEALTHYand Container2 isHEALTHY, and Container3 isHEALTHY, the task health isHEALTHY.
If a task is run manually, and not as part of a service, the task will continue its lifecycle regardless of its health status. For tasks that are part of a service, if the task reports as unhealthy then the task will be stopped and the service scheduler will replace it. When a container health check fails for a task that is part of a service, the following process occurs:
- The task is marked as
UNHEALTHY. - The unhealthy task will be stopped, and during the stopping process, it will go through the following states:
DEACTIVATING- In this state, Amazon ECS performs additional steps before stopping the task. For example, for tasks that are part of services configured to use Elastic Load Balancing target groups, target groups will be deregistered in this state.STOPPING- The task is in the process of being stopped.DEPROVISIONING- Resources associated with the task are being cleaned up.STOPPED- The task has been completely stopped.
- After the old task stops, a new task will be launched to ensure service operation, and the new task will go through the following lifecycle:
PROVISIONING- Resources required for the task are being provisioned.PENDING- The task is waiting to be placed on a container instance.ACTIVATING- In this state, Amazon ECS pulls container images, creates containers, configures task networking, registers load balancer target groups, and configures service discovery status.RUNNING- The task is running and performing its work.
For more detailed information about task lifecycle states, see Task lifecycle in the Amazon Elastic Container Service Developer Guide. The following are notes about container health check support:
- If the Amazon ECS container agent becomes disconnected from the Amazon ECS service, this won't cause a container to transition to an
UNHEALTHYstatus. This is by design, to ensure that containers remain running during agent restarts or temporary unavailability. The health check status is the "last heard from" response from the Amazon ECS agent, so if the container was consideredHEALTHYprior to the disconnect, that status will remain until the agent reconnects and another health check occurs. There are no assumptions made about the status of the container health checks. - Container health checks require version
1.17.0or greater of the Amazon ECS container agent. For more information, see Updating the Amazon ECS container agent. - Container health checks are supported for Fargate tasks if you're using platform version
1.1.0or greater. For more information, see platform versions. - Container health checks aren't supported for tasks that are part of a service that's configured to use a Classic Load Balancer.
For an example of how to specify a task definition with multiple containers where container dependency is specified, see Container dependency in the Amazon Elastic Container Service Developer Guide.
Returns union: either
IResolvableorCfnDaemonTaskDefinition.HealthCheckProperty- See Also:
-
getInteractive
When this parameter istrue, you can deploy containerized applications that requirestdinor attyto be allocated.Returns union: either
BooleanorIResolvable- See Also:
-
getLinuxParameters
The Linux-specific options that are applied to the container, such as Linux KernelCapabilities.Returns union: either
IResolvableorCfnDaemonTaskDefinition.LinuxParametersProperty- See Also:
-
getLogConfiguration
The log configuration for the container.This parameter maps to
LogConfigin the docker container create command and the--log-driveroption to docker run. By default, containers use the same logging driver that the Docker daemon uses. However, the container might use a different logging driver than the Docker daemon by specifying a log driver configuration in the container definition. Understand the following when specifying a log configuration for your containers.- Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon. Additional log drivers may be available in future releases of the Amazon ECS container agent.
For tasks on FARGATElong, the supported log drivers are
awslogs,splunk, andawsfirelens. For tasks hosted on Amazon EC2 instances, the supported log drivers areawslogs,fluentd,gelf,json-file,journald,syslog,splunk, andawsfirelens. - This parameter requires version 1.18 of the Docker Remote API or greater on your container instance.
- For tasks that are hosted on Amazon EC2 instances, the Amazon ECS container agent must register the available logging drivers with the
ECS_AVAILABLE_LOGGING_DRIVERSenvironment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide. - For tasks that are on FARGATElong, because you don't have access to the underlying infrastructure your tasks are hosted on, any additional software needed must be installed outside of the task. For example, the Fluentd output aggregators or a remote host running Logstash to send Gelf logs to.
Returns union: either
IResolvableorCfnDaemonTaskDefinition.LogConfigurationProperty- See Also:
- Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon. Additional log drivers may be available in future releases of the Amazon ECS container agent.
For tasks on FARGATElong, the supported log drivers are
-
getMemory
The amount (in MiB) of memory to present to the container.If the container attempts to exceed the memory specified here, the container is killed.
- See Also:
-
getMemoryReservation
The soft limit (in MiB) of memory to reserve for the container.- See Also:
-
getMountPoints
The mount points for data volumes in your container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.MountPointProperty>- See Also:
-
getPrivileged
When this parameter is true, the container is given elevated privileges on the host container instance (similar to therootuser).Returns union: either
BooleanorIResolvable- See Also:
-
getPseudoTerminal
When this parameter istrue, a TTY is allocated.Returns union: either
BooleanorIResolvable- See Also:
-
getReadonlyRootFilesystem
When this parameter is true, the container is given read-only access to its root file system.Returns union: either
BooleanorIResolvable- See Also:
-
getRepositoryCredentials
The repository credentials for private registry authentication.Returns union: either
IResolvableorCfnDaemonTaskDefinition.RepositoryCredentialsProperty- See Also:
-
getRestartPolicy
Returns union: eitherIResolvableorCfnDaemonTaskDefinition.RestartPolicyProperty- See Also:
-
getSecrets
The secrets to pass to the container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.SecretProperty>- See Also:
-
getStartTimeout
Time duration (in seconds) to wait before giving up on resolving dependencies for a container.- See Also:
-
getStopTimeout
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.- See Also:
-
getSystemControls
A list of namespaced kernel parameters to set in the container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.SystemControlProperty>- See Also:
-
getUlimits
A list ofulimitsto set in the container.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnDaemonTaskDefinition.UlimitProperty>- See Also:
-
getUser
The user to use inside the container.- See Also:
-
getWorkingDirectory
The working directory to run commands inside the container in.- See Also:
-
builder
@Stability(Stable) static CfnDaemonTaskDefinition.DaemonContainerDefinitionProperty.Builder builder()
-