CfnTaskDefinition

class aws_cdk.aws_ecs.CfnTaskDefinition(scope, id, *, container_definitions=None, cpu=None, ephemeral_storage=None, execution_role_arn=None, family=None, inference_accelerators=None, ipc_mode=None, memory=None, network_mode=None, pid_mode=None, placement_constraints=None, proxy_configuration=None, requires_compatibilities=None, runtime_platform=None, tags=None, task_role_arn=None, volumes=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation AWS::ECS::TaskDefinition.

The AWS::ECS::TaskDefinition resource describes the container and volume definitions of an Amazon Elastic Container Service (Amazon ECS) task. You can specify which Docker images to use, the required resources, and other configurations related to launching the task definition through an Amazon ECS service or task.

CloudformationResource

AWS::ECS::TaskDefinition

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

cfn_task_definition = ecs.CfnTaskDefinition(self, "MyCfnTaskDefinition",
    container_definitions=[ecs.CfnTaskDefinition.ContainerDefinitionProperty(
        command=["command"],
        cpu=123,
        depends_on=[ecs.CfnTaskDefinition.ContainerDependencyProperty(
            condition="condition",
            container_name="containerName"
        )],
        disable_networking=False,
        dns_search_domains=["dnsSearchDomains"],
        dns_servers=["dnsServers"],
        docker_labels={
            "docker_labels_key": "dockerLabels"
        },
        docker_security_options=["dockerSecurityOptions"],
        entry_point=["entryPoint"],
        environment=[ecs.CfnTaskDefinition.KeyValuePairProperty(
            name="name",
            value="value"
        )],
        environment_files=[ecs.CfnTaskDefinition.EnvironmentFileProperty(
            type="type",
            value="value"
        )],
        essential=False,
        extra_hosts=[ecs.CfnTaskDefinition.HostEntryProperty(
            hostname="hostname",
            ip_address="ipAddress"
        )],
        firelens_configuration=ecs.CfnTaskDefinition.FirelensConfigurationProperty(
            options={
                "options_key": "options"
            },
            type="type"
        ),
        health_check=ecs.CfnTaskDefinition.HealthCheckProperty(
            command=["command"],
            interval=123,
            retries=123,
            start_period=123,
            timeout=123
        ),
        hostname="hostname",
        image="image",
        interactive=False,
        links=["links"],
        linux_parameters=ecs.CfnTaskDefinition.LinuxParametersProperty(
            capabilities=ecs.CfnTaskDefinition.KernelCapabilitiesProperty(
                add=["add"],
                drop=["drop"]
            ),
            devices=[ecs.CfnTaskDefinition.DeviceProperty(
                container_path="containerPath",
                host_path="hostPath",
                permissions=["permissions"]
            )],
            init_process_enabled=False,
            max_swap=123,
            shared_memory_size=123,
            swappiness=123,
            tmpfs=[ecs.CfnTaskDefinition.TmpfsProperty(
                size=123,

                # the properties below are optional
                container_path="containerPath",
                mount_options=["mountOptions"]
            )]
        ),
        log_configuration=ecs.CfnTaskDefinition.LogConfigurationProperty(
            log_driver="logDriver",

            # the properties below are optional
            options={
                "options_key": "options"
            },
            secret_options=[ecs.CfnTaskDefinition.SecretProperty(
                name="name",
                value_from="valueFrom"
            )]
        ),
        memory=123,
        memory_reservation=123,
        mount_points=[ecs.CfnTaskDefinition.MountPointProperty(
            container_path="containerPath",
            read_only=False,
            source_volume="sourceVolume"
        )],
        name="name",
        port_mappings=[ecs.CfnTaskDefinition.PortMappingProperty(
            container_port=123,
            host_port=123,
            protocol="protocol"
        )],
        privileged=False,
        pseudo_terminal=False,
        readonly_root_filesystem=False,
        repository_credentials=ecs.CfnTaskDefinition.RepositoryCredentialsProperty(
            credentials_parameter="credentialsParameter"
        ),
        resource_requirements=[ecs.CfnTaskDefinition.ResourceRequirementProperty(
            type="type",
            value="value"
        )],
        secrets=[ecs.CfnTaskDefinition.SecretProperty(
            name="name",
            value_from="valueFrom"
        )],
        start_timeout=123,
        stop_timeout=123,
        system_controls=[ecs.CfnTaskDefinition.SystemControlProperty(
            namespace="namespace",
            value="value"
        )],
        ulimits=[ecs.CfnTaskDefinition.UlimitProperty(
            hard_limit=123,
            name="name",
            soft_limit=123
        )],
        user="user",
        volumes_from=[ecs.CfnTaskDefinition.VolumeFromProperty(
            read_only=False,
            source_container="sourceContainer"
        )],
        working_directory="workingDirectory"
    )],
    cpu="cpu",
    ephemeral_storage=ecs.CfnTaskDefinition.EphemeralStorageProperty(
        size_in_gi_b=123
    ),
    execution_role_arn="executionRoleArn",
    family="family",
    inference_accelerators=[ecs.CfnTaskDefinition.InferenceAcceleratorProperty(
        device_name="deviceName",
        device_type="deviceType"
    )],
    ipc_mode="ipcMode",
    memory="memory",
    network_mode="networkMode",
    pid_mode="pidMode",
    placement_constraints=[ecs.CfnTaskDefinition.TaskDefinitionPlacementConstraintProperty(
        type="type",

        # the properties below are optional
        expression="expression"
    )],
    proxy_configuration=ecs.CfnTaskDefinition.ProxyConfigurationProperty(
        container_name="containerName",

        # the properties below are optional
        proxy_configuration_properties=[ecs.CfnTaskDefinition.KeyValuePairProperty(
            name="name",
            value="value"
        )],
        type="type"
    ),
    requires_compatibilities=["requiresCompatibilities"],
    runtime_platform=ecs.CfnTaskDefinition.RuntimePlatformProperty(
        cpu_architecture="cpuArchitecture",
        operating_system_family="operatingSystemFamily"
    ),
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    task_role_arn="taskRoleArn",
    volumes=[ecs.CfnTaskDefinition.VolumeProperty(
        docker_volume_configuration=ecs.CfnTaskDefinition.DockerVolumeConfigurationProperty(
            autoprovision=False,
            driver="driver",
            driver_opts={
                "driver_opts_key": "driverOpts"
            },
            labels={
                "labels_key": "labels"
            },
            scope="scope"
        ),
        efs_volume_configuration=ecs.CfnTaskDefinition.EFSVolumeConfigurationProperty(
            filesystem_id="filesystemId",

            # the properties below are optional
            authorization_config=ecs.CfnTaskDefinition.AuthorizationConfigProperty(
                access_point_id="accessPointId",
                iam="iam"
            ),
            root_directory="rootDirectory",
            transit_encryption="transitEncryption",
            transit_encryption_port=123
        ),
        host=ecs.CfnTaskDefinition.HostVolumePropertiesProperty(
            source_path="sourcePath"
        ),
        name="name"
    )]
)

Create a new AWS::ECS::TaskDefinition.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • container_definitions (Union[IResolvable, Sequence[Union[ContainerDefinitionProperty, Dict[str, Any], IResolvable]], None]) – A list of container definitions in JSON format that describe the different containers that make up your task. For more information about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide .

  • cpu (Optional[str]) – The number of cpu units used by the task. If you use the EC2 launch type, this field is optional. Any value can be used. If you use the Fargate launch type, this field is required. You must use one of the following values. The value that you choose determines your range of valid values for the memory parameter. The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate. - 256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - 512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - 1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - 2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - 4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)

  • ephemeral_storage (Union[IResolvable, EphemeralStorageProperty, Dict[str, Any], None]) – The ephemeral storage settings to use for tasks run with the task definition.

  • execution_role_arn (Optional[str]) – The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make AWS API calls on your behalf. The task execution IAM role is required depending on the requirements of your task. For more information, see Amazon ECS task execution IAM role in the Amazon Elastic Container Service Developer Guide .

  • family (Optional[str]) – The name of a family that this task definition is registered to. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. A family groups multiple versions of a task definition. Amazon ECS gives the first task definition that you registered to a family a revision number of 1. Amazon ECS gives sequential revision numbers to each task definition that you add. .. epigraph:: To use revision numbers when you update a task definition, specify this property. If you don’t specify a value, AWS CloudFormation generates a new task definition each time that you update it.

  • inference_accelerators (Union[IResolvable, Sequence[Union[IResolvable, InferenceAcceleratorProperty, Dict[str, Any]]], None]) – The Elastic Inference accelerators to use for the containers in the task.

  • ipc_mode (Optional[str]) – The IPC resource namespace to use for the containers in the task. The valid values are host , task , or none . If host is specified, then all containers within the tasks that specified the host IPC mode on the same container instance share the same IPC resources with the host Amazon EC2 instance. If task is specified, all containers within the specified task share the same IPC resources. If none is specified, then IPC resources within the containers of a task are private and not shared with other containers in a task or on the container instance. If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the container instance. For more information, see IPC settings in the Docker run reference . If the host IPC mode is used, be aware that there is a heightened risk of undesired IPC namespace expose. For more information, see Docker security . If you are setting namespaced kernel parameters using systemControls for the containers in the task, the following will apply to your IPC resource namespace. For more information, see System Controls in the Amazon Elastic Container Service Developer Guide . - For tasks that use the host IPC mode, IPC namespace related systemControls are not supported. - For tasks that use the task IPC mode, IPC namespace related systemControls will apply to all containers within a task. .. epigraph:: This parameter is not supported for Windows containers or tasks run on AWS Fargate .

  • memory (Optional[str]) – The amount (in MiB) of memory used by the task. If your tasks runs on Amazon EC2 instances, you must specify either a task-level memory value or a container-level memory value. This field is optional and any value can be used. If a task-level memory value is specified, the container-level memory value is optional. For more information regarding container-level memory and memory reservation, see ContainerDefinition . If your tasks runs on AWS Fargate , this field is required. You must use one of the following values. The value you choose determines your range of valid values for the cpu parameter. - 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) - 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) - 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) - Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) - Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

  • network_mode (Optional[str]) – The Docker networking mode to use for the containers in the task. The valid values are none , bridge , awsvpc , and host . The default Docker network mode is bridge . If you are using the Fargate launch type, the awsvpc network mode is required. If you are using the EC2 launch type, any network mode can be used. If the network mode is set to none , you cannot specify port mappings in your container definitions, and the tasks containers do not have external connectivity. The host and awsvpc network modes offer the highest networking performance for containers because they use the EC2 network stack instead of the virtualized network stack provided by the bridge mode. With the host and awsvpc network modes, exposed container ports are mapped directly to the corresponding host port (for the host network mode) or the attached elastic network interface port (for the awsvpc network mode), so you cannot take advantage of dynamic host port mappings. If the network mode is awsvpc , the task is allocated an elastic network interface, and you must specify a NetworkConfiguration value when you create a service or run a task with the task definition. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide . .. epigraph:: Currently, only Amazon ECS-optimized AMIs, other Amazon Linux variants with the ecs-init package, or AWS Fargate infrastructure support the awsvpc network mode. If the network mode is host , you cannot run multiple instantiations of the same task on a single container instance when port mappings are used. Docker for Windows uses different network modes than Docker for Linux. When you register a task definition with Windows containers, you must not specify a network mode. If you use the console to register a task definition with Windows containers, you must choose the <default> network mode object. For more information, see Network settings in the Docker run reference .

  • pid_mode (Optional[str]) –

    The process namespace to use for the containers in the task. The valid values are host or task . If host is specified, then all containers within the tasks that specified the host PID mode on the same container instance share the same process namespace with the host Amazon EC2 instance. If task is specified, all containers within the specified task share the same process namespace. If no value is specified, the default is a private namespace. For more information, see PID settings in the Docker run reference . If the host PID mode is used, be aware that there is a heightened risk of undesired process namespace expose. For more information, see Docker security . .. epigraph:: This parameter is not supported for Windows containers or tasks run on AWS Fargate .

  • placement_constraints (Union[IResolvable, Sequence[Union[IResolvable, TaskDefinitionPlacementConstraintProperty, Dict[str, Any]]], None]) – An array of placement constraint objects to use for tasks. .. epigraph:: This parameter isn’t supported for tasks run on AWS Fargate .

  • proxy_configuration (Union[ProxyConfigurationProperty, Dict[str, Any], IResolvable, None]) – The ProxyConfiguration property specifies the configuration details for the App Mesh proxy. Your Amazon ECS container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of the ecs-init package to enable a proxy configuration. If your container instances are launched from the Amazon ECS-optimized AMI version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

  • requires_compatibilities (Optional[Sequence[str]]) – The task launch types the task definition was validated against. To determine which task launch types the task definition is validated for, see the TaskDefinition$compatibilities parameter.

  • runtime_platform (Union[IResolvable, RuntimePlatformProperty, Dict[str, Any], None]) – The operating system that your tasks definitions run on. A platform family is specified only for tasks using the Fargate launch type. When you specify a task definition in a service, this value must match the runtimePlatform value of the service.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists of a key and an optional value. You define both of them. The following basic restrictions apply to tags: - Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. - Tag keys and values are case-sensitive. - Do not use aws: , AWS: , or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.

  • task_role_arn (Optional[str]) – The short name or full Amazon Resource Name (ARN) of the AWS Identity and Access Management role that grants containers in the task permission to call AWS APIs on your behalf. For more information, see Amazon ECS Task Role in the Amazon Elastic Container Service Developer Guide . IAM roles for tasks on Windows require that the -EnableTaskIAMRole option is set when you launch the Amazon ECS-optimized Windows AMI. Your containers must also run some configuration code to use the feature. For more information, see Windows IAM roles for tasks in the Amazon Elastic Container Service Developer Guide .

  • volumes (Union[IResolvable, Sequence[Union[IResolvable, VolumeProperty, Dict[str, Any]]], None]) – The list of data volume definitions for the task. For more information, see Using data volumes in tasks in the Amazon Elastic Container Service Developer Guide . .. epigraph:: The host and sourcePath parameters aren’t supported for tasks run on AWS Fargate .

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::ECS::TaskDefinition'
attr_task_definition_arn

TaskDefinitionArn

Type

cloudformationAttribute

Return type

str

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

container_definitions

A list of container definitions in JSON format that describe the different containers that make up your task.

For more information about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-containerdefinitions

Return type

Union[IResolvable, List[Union[ContainerDefinitionProperty, IResolvable]], None]

cpu

The number of cpu units used by the task.

If you use the EC2 launch type, this field is optional. Any value can be used. If you use the Fargate launch type, this field is required. You must use one of the following values. The value that you choose determines your range of valid values for the memory parameter.

The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate.

  • 256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)

  • 512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)

  • 1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)

  • 2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)

  • 4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-cpu

Return type

Optional[str]

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

ephemeral_storage

The ephemeral storage settings to use for tasks run with the task definition.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-ephemeralstorage

Return type

Union[IResolvable, EphemeralStorageProperty, None]

execution_role_arn

The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make AWS API calls on your behalf.

The task execution IAM role is required depending on the requirements of your task. For more information, see Amazon ECS task execution IAM role in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-executionrolearn

Return type

Optional[str]

family

The name of a family that this task definition is registered to.

Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

A family groups multiple versions of a task definition. Amazon ECS gives the first task definition that you registered to a family a revision number of 1. Amazon ECS gives sequential revision numbers to each task definition that you add. .. epigraph:

To use revision numbers when you update a task definition, specify this property. If you don't specify a value, AWS CloudFormation generates a new task definition each time that you update it.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-family

Return type

Optional[str]

inference_accelerators

The Elastic Inference accelerators to use for the containers in the task.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-inferenceaccelerators

Return type

Union[IResolvable, List[Union[IResolvable, InferenceAcceleratorProperty]], None]

ipc_mode

The IPC resource namespace to use for the containers in the task.

The valid values are host , task , or none . If host is specified, then all containers within the tasks that specified the host IPC mode on the same container instance share the same IPC resources with the host Amazon EC2 instance. If task is specified, all containers within the specified task share the same IPC resources. If none is specified, then IPC resources within the containers of a task are private and not shared with other containers in a task or on the container instance. If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the container instance. For more information, see IPC settings in the Docker run reference .

If the host IPC mode is used, be aware that there is a heightened risk of undesired IPC namespace expose. For more information, see Docker security .

If you are setting namespaced kernel parameters using systemControls for the containers in the task, the following will apply to your IPC resource namespace. For more information, see System Controls in the Amazon Elastic Container Service Developer Guide .

  • For tasks that use the host IPC mode, IPC namespace related systemControls are not supported.

  • For tasks that use the task IPC mode, IPC namespace related systemControls will apply to all containers within a task.

This parameter is not supported for Windows containers or tasks run on AWS Fargate .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-ipcmode

Return type

Optional[str]

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

memory

The amount (in MiB) of memory used by the task.

If your tasks runs on Amazon EC2 instances, you must specify either a task-level memory value or a container-level memory value. This field is optional and any value can be used. If a task-level memory value is specified, the container-level memory value is optional. For more information regarding container-level memory and memory reservation, see ContainerDefinition .

If your tasks runs on AWS Fargate , this field is required. You must use one of the following values. The value you choose determines your range of valid values for the cpu parameter.

  • 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)

  • 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)

  • 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)

  • Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)

  • Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-memory

Return type

Optional[str]

network_mode

The Docker networking mode to use for the containers in the task.

The valid values are none , bridge , awsvpc , and host . The default Docker network mode is bridge . If you are using the Fargate launch type, the awsvpc network mode is required. If you are using the EC2 launch type, any network mode can be used. If the network mode is set to none , you cannot specify port mappings in your container definitions, and the tasks containers do not have external connectivity. The host and awsvpc network modes offer the highest networking performance for containers because they use the EC2 network stack instead of the virtualized network stack provided by the bridge mode.

With the host and awsvpc network modes, exposed container ports are mapped directly to the corresponding host port (for the host network mode) or the attached elastic network interface port (for the awsvpc network mode), so you cannot take advantage of dynamic host port mappings.

If the network mode is awsvpc , the task is allocated an elastic network interface, and you must specify a NetworkConfiguration value when you create a service or run a task with the task definition. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide . .. epigraph:

Currently, only Amazon ECS-optimized AMIs, other Amazon Linux variants with the ``ecs-init`` package, or AWS Fargate infrastructure support the ``awsvpc`` network mode.

If the network mode is host , you cannot run multiple instantiations of the same task on a single container instance when port mappings are used.

Docker for Windows uses different network modes than Docker for Linux. When you register a task definition with Windows containers, you must not specify a network mode. If you use the console to register a task definition with Windows containers, you must choose the <default> network mode object.

For more information, see Network settings in the Docker run reference .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-networkmode

Return type

Optional[str]

node

The construct tree node associated with this construct.

Return type

ConstructNode

pid_mode

The process namespace to use for the containers in the task.

The valid values are host or task . If host is specified, then all containers within the tasks that specified the host PID mode on the same container instance share the same process namespace with the host Amazon EC2 instance. If task is specified, all containers within the specified task share the same process namespace. If no value is specified, the default is a private namespace. For more information, see PID settings in the Docker run reference .

If the host PID mode is used, be aware that there is a heightened risk of undesired process namespace expose. For more information, see Docker security . .. epigraph:

This parameter is not supported for Windows containers or tasks run on AWS Fargate .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-pidmode

Return type

Optional[str]

placement_constraints

An array of placement constraint objects to use for tasks.

This parameter isn’t supported for tasks run on AWS Fargate .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-placementconstraints

Return type

Union[IResolvable, List[Union[IResolvable, TaskDefinitionPlacementConstraintProperty]], None]

proxy_configuration

The ProxyConfiguration property specifies the configuration details for the App Mesh proxy.

Your Amazon ECS container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of the ecs-init package to enable a proxy configuration. If your container instances are launched from the Amazon ECS-optimized AMI version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-proxyconfiguration

Return type

Union[ProxyConfigurationProperty, IResolvable, None]

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

requires_compatibilities

The task launch types the task definition was validated against.

To determine which task launch types the task definition is validated for, see the TaskDefinition$compatibilities parameter.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-requirescompatibilities

Return type

Optional[List[str]]

runtime_platform

The operating system that your tasks definitions run on.

A platform family is specified only for tasks using the Fargate launch type.

When you specify a task definition in a service, this value must match the runtimePlatform value of the service.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-runtimeplatform

Return type

Union[IResolvable, RuntimePlatformProperty, None]

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

tags

The metadata that you apply to the task definition to help you categorize and organize them.

Each tag consists of a key and an optional value. You define both of them.

The following basic restrictions apply to tags:

  • Maximum number of tags per resource - 50

  • For each resource, each tag key must be unique, and each tag key can have only one value.

  • Maximum key length - 128 Unicode characters in UTF-8

  • Maximum value length - 256 Unicode characters in UTF-8

  • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

  • Tag keys and values are case-sensitive.

  • Do not use aws: , AWS: , or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-tags

Return type

TagManager

task_role_arn

The short name or full Amazon Resource Name (ARN) of the AWS Identity and Access Management role that grants containers in the task permission to call AWS APIs on your behalf.

For more information, see Amazon ECS Task Role in the Amazon Elastic Container Service Developer Guide .

IAM roles for tasks on Windows require that the -EnableTaskIAMRole option is set when you launch the Amazon ECS-optimized Windows AMI. Your containers must also run some configuration code to use the feature. For more information, see Windows IAM roles for tasks in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-taskrolearn

Return type

Optional[str]

volumes

The list of data volume definitions for the task.

For more information, see Using data volumes in tasks in the Amazon Elastic Container Service Developer Guide . .. epigraph:

The ``host`` and ``sourcePath`` parameters aren't supported for tasks run on AWS Fargate .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-volumes

Return type

Union[IResolvable, List[Union[IResolvable, VolumeProperty]], None]

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

AuthorizationConfigProperty

class CfnTaskDefinition.AuthorizationConfigProperty(*, access_point_id=None, iam=None)

Bases: object

The authorization configuration details for the Amazon EFS file system.

Parameters
  • access_point_id (Optional[str]) – The Amazon EFS access point ID to use. If an access point is specified, the root directory value specified in the EFSVolumeConfiguration must either be omitted or set to / which will enforce the path set on the EFS access point. If an access point is used, transit encryption must be enabled in the EFSVolumeConfiguration . For more information, see Working with Amazon EFS access points in the Amazon Elastic File System User Guide .

  • iam (Optional[str]) – Determines whether to use the Amazon ECS task IAM role defined in a task definition when mounting the Amazon EFS file system. If enabled, transit encryption must be enabled in the EFSVolumeConfiguration . If this parameter is omitted, the default value of DISABLED is used. For more information, see Using Amazon EFS access points in the Amazon Elastic Container Service Developer Guide .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

authorization_config_property = ecs.CfnTaskDefinition.AuthorizationConfigProperty(
    access_point_id="accessPointId",
    iam="iam"
)

Attributes

access_point_id

The Amazon EFS access point ID to use.

If an access point is specified, the root directory value specified in the EFSVolumeConfiguration must either be omitted or set to / which will enforce the path set on the EFS access point. If an access point is used, transit encryption must be enabled in the EFSVolumeConfiguration . For more information, see Working with Amazon EFS access points in the Amazon Elastic File System User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-authorizationconfig.html#cfn-ecs-taskdefinition-authorizationconfig-accesspointid

Return type

Optional[str]

iam

Determines whether to use the Amazon ECS task IAM role defined in a task definition when mounting the Amazon EFS file system.

If enabled, transit encryption must be enabled in the EFSVolumeConfiguration . If this parameter is omitted, the default value of DISABLED is used. For more information, see Using Amazon EFS access points in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-authorizationconfig.html#cfn-ecs-taskdefinition-authorizationconfig-iam

Return type

Optional[str]

ContainerDefinitionProperty

class CfnTaskDefinition.ContainerDefinitionProperty(*, command=None, cpu=None, depends_on=None, disable_networking=None, dns_search_domains=None, dns_servers=None, docker_labels=None, docker_security_options=None, entry_point=None, environment=None, environment_files=None, essential=None, extra_hosts=None, firelens_configuration=None, health_check=None, hostname=None, image=None, interactive=None, links=None, linux_parameters=None, log_configuration=None, memory=None, memory_reservation=None, mount_points=None, name=None, port_mappings=None, privileged=None, pseudo_terminal=None, readonly_root_filesystem=None, repository_credentials=None, resource_requirements=None, secrets=None, start_timeout=None, stop_timeout=None, system_controls=None, ulimits=None, user=None, volumes_from=None, working_directory=None)

Bases: object

The ContainerDefinition property specifies a container definition.

Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

Parameters
  • command (Optional[Sequence[str]]) – The command that’s passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#cmd . If there are multiple arguments, each argument is a separated string in the array.

  • cpu (Union[int, float, None]) –

    The number of cpu units reserved for the container. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run . This field is optional for tasks using the Fargate launch type, and the only requirement is that the total amount of CPU reserved for all containers within a task be lower than the task-level cpu value. .. epigraph:: You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances detail page by 1,024. Linux containers share unallocated CPU units with other containers on the container instance with the same ratio as their allocated amount. For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that’s the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task is guaranteed a minimum of 512 CPU units when needed. Moreover, each container could float to higher CPU usage if the other container was not using it. If both tasks were 100% active all of the time, they would be limited to 512 CPU units. On Linux container instances, the Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2. However, the CPU parameter isn’t required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version: - Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to two CPU shares. - Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2. On Windows container instances, the CPU limit is enforced as an absolute limit, or a quota. Windows containers only have access to the specified amount of CPU that’s described in the task definition. A null or zero CPU value is passed to Docker as 0 , which Windows interprets as 1% of one CPU.

  • depends_on (Union[IResolvable, Sequence[Union[IResolvable, ContainerDependencyProperty, Dict[str, Any]]], None]) –

    The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed. For tasks using the EC2 launch type, the container instances require at least version 1.26.0 of the container agent to turn on container dependencies. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide . For tasks using the Fargate launch type, the task or service requires the following platforms: - Linux platform version 1.3.0 or later. - Windows platform version 1.0.0 or later.

  • disable_networking (Union[bool, IResolvable, None]) –

    When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API . .. epigraph:: This parameter is not supported for Windows containers.

  • dns_search_domains (Optional[Sequence[str]]) –

    A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run . .. epigraph:: This parameter is not supported for Windows containers.

  • dns_servers (Optional[Sequence[str]]) –

    A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run . .. epigraph:: This parameter is not supported for Windows containers.

  • docker_labels (Union[IResolvable, Mapping[str, str], None]) –

    A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run . This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

  • docker_security_options (Optional[Sequence[str]]) –

    A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This field isn’t valid for containers in tasks using the Fargate launch type. With Windows containers, this parameter can be used to reference a credential spec file when configuring a container for Active Directory authentication. For more information, see Using gMSAs for Windows Containers in the Amazon Elastic Container Service Developer Guide . This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run . .. epigraph:: The Amazon ECS container agent running on a container instance must register with the ECS_SELINUX_CAPABLE=true or ECS_APPARMOR_CAPABLE=true environment variables before containers placed on that instance can use these security options. For more information, see Amazon ECS Container Agent Configuration in the Amazon Elastic Container Service Developer Guide . For more information about valid values, see Docker Run Security Configuration . Valid values: “no-new-privileges” | “apparmor:PROFILE” | “label:value” | “credentialspec:CredentialSpecFilePath”

  • entry_point (Optional[Sequence[str]]) –

    Early versions of the Amazon ECS container agent don’t properly handle entryPoint parameters. If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead. The entry point that’s passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#entrypoint .

  • environment (Union[IResolvable, Sequence[Union[IResolvable, KeyValuePairProperty, Dict[str, Any]]], None]) –

    The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run . .. epigraph:: We don’t recommend that you use plaintext environment variables for sensitive information, such as credential data.

  • environment_files (Union[IResolvable, Sequence[Union[IResolvable, EnvironmentFileProperty, Dict[str, Any]]], None]) –

    A list of files containing the environment variables to pass to a container. This parameter maps to the --env-file option to docker run . You can specify up to ten environment files. The file must have a .env file extension. Each line in an environment file contains an environment variable in VARIABLE=VALUE format. Lines beginning with # are treated as comments and are ignored. For more information about the environment variable file syntax, see Declare default environment variables in file . If there are environment variables specified using the environment parameter in a container definition, they take precedence over the variables contained within an environment file. If multiple environment files are specified that contain the same variable, they’re processed from the top down. We recommend that you use unique variable names. For more information, see Specifying Environment Variables in the Amazon Elastic Container Service Developer Guide .

  • essential (Union[bool, IResolvable, None]) – If the essential parameter of a container is marked as true , and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false , its failure doesn’t affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential. All tasks must have at least one essential container. If you have an application that’s composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide .

  • extra_hosts (Union[IResolvable, Sequence[Union[IResolvable, HostEntryProperty, Dict[str, Any]]], None]) –

    A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run . .. epigraph:: This parameter isn’t supported for Windows containers or tasks that use the awsvpc network mode.

  • firelens_configuration (Union[IResolvable, FirelensConfigurationProperty, Dict[str, Any], None]) – 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 .

  • health_check (Union[IResolvable, HealthCheckProperty, Dict[str, Any], None]) –

    The container health check command and associated configuration parameters for the container. This parameter maps to HealthCheck in the Create a container section of the Docker Remote API and the HEALTHCHECK parameter of docker run .

  • hostname (Optional[str]) –

    The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run . .. epigraph:: The hostname parameter is not supported if you’re using the awsvpc network mode.

  • image (Optional[str]) –

    The image used to start a container. This string is passed directly to the Docker daemon. By default, images in the Docker Hub registry are available. Other repositories are specified with either *repository-url* / *image* : *tag* or *repository-url* / *image* @ *digest* . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run . - When a new task starts, the Amazon ECS container agent pulls the latest version of the specified image and tag for the container to use. However, subsequent updates to a repository image aren’t propagated to already running tasks. - Images in Amazon ECR repositories can be specified by either using the full registry/repository:tag or registry/repository@digest . For example, 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>:latest or 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>@sha256:94afd1f2e64d908bc90dbca0035a5b567EXAMPLE . - Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ). - Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ). - Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

  • interactive (Union[bool, IResolvable, None]) –

    When this parameter is true , you can deploy containerized applications that require stdin or a tty to be allocated. This parameter maps to OpenStdin in the Create a container section of the Docker Remote API and the --interactive option to docker run .

  • links (Optional[Sequence[str]]) –

    The links parameter allows containers to communicate with each other without the need for port mappings. This parameter is only supported if the network mode of a task definition is bridge . The name:internalName construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. For more information about linking Docker containers, go to Legacy container links in the Docker documentation. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run . .. epigraph:: This parameter is not supported for Windows containers. > Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.

  • linux_parameters (Union[LinuxParametersProperty, Dict[str, Any], IResolvable, None]) – Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information see KernelCapabilities . .. epigraph:: This parameter is not supported for Windows containers.

  • log_configuration (Union[IResolvable, LogConfigurationProperty, Dict[str, Any], None]) –

    The log configuration specification for the container. This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run . By default, containers use the same logging driver that the Docker daemon uses. However, the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation. .. epigraph:: Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Additional log drivers may be available in future releases of the Amazon ECS container agent. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}' .. epigraph:: The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment 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 .

  • memory (Union[int, float, None]) –

    The amount (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed. The total amount of memory reserved for all containers within a task must be lower than the task memory value, if one is specified. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run . If using the Fargate launch type, this parameter is optional. If using the EC2 launch type, you must specify either a task-level memory value or a container-level memory value. If you specify both a container-level memory and memoryReservation value, memory must be greater than memoryReservation . If you specify memoryReservation , then that value is subtracted from the available memory resources for the container instance where the container is placed. Otherwise, the value of memory is used. The Docker 20.10.0 or later daemon reserves a minimum of 6 MiB of memory for a container, so you should not specify fewer than 6 MiB of memory for your containers. The Docker 19.03.13-ce or earlier daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers.

  • memory_reservation (Union[int, float, None]) –

    The soft limit (in MiB) of memory to reserve for the container. When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first. This parameter maps to MemoryReservation in the Create a container section of the Docker Remote API and the --memory-reservation option to docker run . If a task-level memory value is not specified, you must specify a non-zero integer for one or both of memory or memoryReservation in a container definition. If you specify both, memory must be greater than memoryReservation . If you specify memoryReservation , then that value is subtracted from the available memory resources for the container instance where the container is placed. Otherwise, the value of memory is used. For example, if your container normally uses 128 MiB of memory, but occasionally bursts to 256 MiB of memory for short periods of time, you can set a memoryReservation of 128 MiB, and a memory hard limit of 300 MiB. This configuration would allow the container to only reserve 128 MiB of memory from the remaining resources on the container instance, but also allow the container to consume more memory resources when needed. The Docker daemon reserves a minimum of 4 MiB of memory for a container. Therefore, we recommend that you specify fewer than 4 MiB of memory for your containers.

  • mount_points (Union[IResolvable, Sequence[Union[IResolvable, MountPointProperty, Dict[str, Any]]], None]) –

    The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run . Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can’t mount directories on a different drive, and mount point can’t be across drives.

  • name (Optional[str]) –

    The name of a container. If you’re linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run .

  • port_mappings (Union[IResolvable, Sequence[Union[IResolvable, PortMappingProperty, Dict[str, Any]]], None]) –

    The list of port mappings for the container. Port mappings allow containers to access ports on the host container instance to send or receive traffic. For task definitions that use the awsvpc network mode, you should only specify the containerPort . The hostPort can be left blank or it must be the same value as the containerPort . Port mappings on Windows use the NetNAT gateway address rather than localhost . There is no loopback for port mappings on Windows, so you cannot access a container’s mapped port from the host itself. This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run . If the network mode of a task definition is set to none , then you can’t specify port mappings. If the network mode of a task definition is set to host , then host ports must either be undefined or they must match the container port in the port mapping. .. epigraph:: After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description for a selected task in the Amazon ECS console. The assignments are also visible in the networkBindings section DescribeTasks responses.

  • privileged (Union[bool, IResolvable, None]) –

    When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run . .. epigraph:: This parameter is not supported for Windows containers or tasks run on AWS Fargate .

  • pseudo_terminal (Union[bool, IResolvable, None]) –

    When this parameter is true , a TTY is allocated. This parameter maps to Tty in the Create a container section of the Docker Remote API and the --tty option to docker run .

  • readonly_root_filesystem (Union[bool, IResolvable, None]) –

    When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run . .. epigraph:: This parameter is not supported for Windows containers.

  • repository_credentials (Union[RepositoryCredentialsProperty, Dict[str, Any], IResolvable, None]) – The private repository authentication credentials to use.

  • resource_requirements (Union[IResolvable, Sequence[Union[IResolvable, ResourceRequirementProperty, Dict[str, Any]]], None]) – The type and amount of a resource to assign to a container. The only supported resource is a GPU.

  • secrets (Union[IResolvable, Sequence[Union[SecretProperty, Dict[str, Any], IResolvable]], None]) – The secrets to pass to the container. For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide .

  • start_timeout (Union[int, float, None]) –

    Time duration (in seconds) to wait before giving up on resolving dependencies for a container. For example, you specify two containers in a task definition with containerA having a dependency on containerB reaching a COMPLETE , SUCCESS , or HEALTHY status. If a startTimeout value is specified for containerB and it doesn’t reach the desired status within that time then containerA gives up and not start. This results in the task transitioning to a STOPPED state. .. epigraph:: When the ECS_CONTAINER_START_TIMEOUT container agent configuration variable is used, it’s enforced independently from this start timeout value. For tasks using the Fargate launch type, the task or service requires the following platforms: - Linux platform version 1.3.0 or later. - Windows platform version 1.0.0 or later. For tasks using the EC2 launch type, your container instances require at least version 1.26.0 of the container agent to use a container start timeout value. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

  • stop_timeout (Union[int, float, None]) –

    Time duration (in seconds) to wait before the container is forcefully killed if it doesn’t exit normally on its own. For tasks using the Fargate launch type, the task or service requires the following platforms: - Linux platform version 1.3.0 or later. - Windows platform version 1.0.0 or later. The max stop timeout value is 120 seconds and if the parameter is not specified, the default value of 30 seconds is used. For tasks that use the EC2 launch type, if the stopTimeout parameter isn’t specified, the value set for the Amazon ECS container agent configuration variable ECS_CONTAINER_STOP_TIMEOUT is used. If neither the stopTimeout parameter or the ECS_CONTAINER_STOP_TIMEOUT agent configuration variable are set, then the default values of 30 seconds for Linux containers and 30 seconds on Windows containers are used. Your container instances require at least version 1.26.0 of the container agent to use a container stop timeout value. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

  • system_controls (Union[IResolvable, Sequence[Union[IResolvable, SystemControlProperty, Dict[str, Any]]], None]) –

    A list of namespaced kernel parameters to set in the container. This parameter maps to Sysctls in the Create a container section of the Docker Remote API and the --sysctl option to docker run . .. epigraph:: We don’t recommended that you specify network-related systemControls parameters for multiple containers in a single task that also uses either the awsvpc or host network modes. For tasks that use the awsvpc network mode, the container that’s started last determines which systemControls parameters take effect. For tasks that use the host network mode, it changes the container instance’s namespaced kernel parameters as well as the containers.

  • ulimits (Union[IResolvable, Sequence[Union[IResolvable, UlimitProperty, Dict[str, Any]]], None]) –

    A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run . Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}' .. epigraph:: This parameter is not supported for Windows containers.

  • user (Optional[str]) –

    The user to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run . .. epigraph:: When running tasks using the host network mode, don’t run containers using the root user (UID 0). We recommend using a non-root user for better security. You can specify the user using the following formats. If specifying a UID or GID, you must specify it as a positive integer. - user - user:group - uid - uid:gid - user:gid - uid:group .. epigraph:: This parameter is not supported for Windows containers.

  • volumes_from (Union[IResolvable, Sequence[Union[IResolvable, VolumeFromProperty, Dict[str, Any]]], None]) –

    Data volumes to mount from another container. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run .

  • working_directory (Optional[str]) –

    The working directory to run commands inside the container in. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

container_definition_property = ecs.CfnTaskDefinition.ContainerDefinitionProperty(
    command=["command"],
    cpu=123,
    depends_on=[ecs.CfnTaskDefinition.ContainerDependencyProperty(
        condition="condition",
        container_name="containerName"
    )],
    disable_networking=False,
    dns_search_domains=["dnsSearchDomains"],
    dns_servers=["dnsServers"],
    docker_labels={
        "docker_labels_key": "dockerLabels"
    },
    docker_security_options=["dockerSecurityOptions"],
    entry_point=["entryPoint"],
    environment=[ecs.CfnTaskDefinition.KeyValuePairProperty(
        name="name",
        value="value"
    )],
    environment_files=[ecs.CfnTaskDefinition.EnvironmentFileProperty(
        type="type",
        value="value"
    )],
    essential=False,
    extra_hosts=[ecs.CfnTaskDefinition.HostEntryProperty(
        hostname="hostname",
        ip_address="ipAddress"
    )],
    firelens_configuration=ecs.CfnTaskDefinition.FirelensConfigurationProperty(
        options={
            "options_key": "options"
        },
        type="type"
    ),
    health_check=ecs.CfnTaskDefinition.HealthCheckProperty(
        command=["command"],
        interval=123,
        retries=123,
        start_period=123,
        timeout=123
    ),
    hostname="hostname",
    image="image",
    interactive=False,
    links=["links"],
    linux_parameters=ecs.CfnTaskDefinition.LinuxParametersProperty(
        capabilities=ecs.CfnTaskDefinition.KernelCapabilitiesProperty(
            add=["add"],
            drop=["drop"]
        ),
        devices=[ecs.CfnTaskDefinition.DeviceProperty(
            container_path="containerPath",
            host_path="hostPath",
            permissions=["permissions"]
        )],
        init_process_enabled=False,
        max_swap=123,
        shared_memory_size=123,
        swappiness=123,
        tmpfs=[ecs.CfnTaskDefinition.TmpfsProperty(
            size=123,

            # the properties below are optional
            container_path="containerPath",
            mount_options=["mountOptions"]
        )]
    ),
    log_configuration=ecs.CfnTaskDefinition.LogConfigurationProperty(
        log_driver="logDriver",

        # the properties below are optional
        options={
            "options_key": "options"
        },
        secret_options=[ecs.CfnTaskDefinition.SecretProperty(
            name="name",
            value_from="valueFrom"
        )]
    ),
    memory=123,
    memory_reservation=123,
    mount_points=[ecs.CfnTaskDefinition.MountPointProperty(
        container_path="containerPath",
        read_only=False,
        source_volume="sourceVolume"
    )],
    name="name",
    port_mappings=[ecs.CfnTaskDefinition.PortMappingProperty(
        container_port=123,
        host_port=123,
        protocol="protocol"
    )],
    privileged=False,
    pseudo_terminal=False,
    readonly_root_filesystem=False,
    repository_credentials=ecs.CfnTaskDefinition.RepositoryCredentialsProperty(
        credentials_parameter="credentialsParameter"
    ),
    resource_requirements=[ecs.CfnTaskDefinition.ResourceRequirementProperty(
        type="type",
        value="value"
    )],
    secrets=[ecs.CfnTaskDefinition.SecretProperty(
        name="name",
        value_from="valueFrom"
    )],
    start_timeout=123,
    stop_timeout=123,
    system_controls=[ecs.CfnTaskDefinition.SystemControlProperty(
        namespace="namespace",
        value="value"
    )],
    ulimits=[ecs.CfnTaskDefinition.UlimitProperty(
        hard_limit=123,
        name="name",
        soft_limit=123
    )],
    user="user",
    volumes_from=[ecs.CfnTaskDefinition.VolumeFromProperty(
        read_only=False,
        source_container="sourceContainer"
    )],
    working_directory="workingDirectory"
)

Attributes

command

The command that’s passed to the container.

This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#cmd . If there are multiple arguments, each argument is a separated string in the array.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-command

Return type

Optional[List[str]]

cpu

The number of cpu units reserved for the container.

This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run .

This field is optional for tasks using the Fargate launch type, and the only requirement is that the total amount of CPU reserved for all containers within a task be lower than the task-level cpu value. .. epigraph:

You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the `Amazon EC2 Instances <https://docs.aws.amazon.com/ec2/instance-types/>`_ detail page by 1,024.

Linux containers share unallocated CPU units with other containers on the container instance with the same ratio as their allocated amount. For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that’s the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task is guaranteed a minimum of 512 CPU units when needed. Moreover, each container could float to higher CPU usage if the other container was not using it. If both tasks were 100% active all of the time, they would be limited to 512 CPU units.

On Linux container instances, the Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2. However, the CPU parameter isn’t required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

  • Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to two CPU shares.

  • Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2.

On Windows container instances, the CPU limit is enforced as an absolute limit, or a quota. Windows containers only have access to the specified amount of CPU that’s described in the task definition. A null or zero CPU value is passed to Docker as 0 , which Windows interprets as 1% of one CPU.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-cpu

Return type

Union[int, float, None]

depends_on

The dependencies defined for container startup and shutdown.

A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed.

For tasks using the EC2 launch type, the container instances require at least version 1.26.0 of the container agent to turn on container dependencies. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

For tasks using the Fargate launch type, the task or service requires the following platforms:

  • Linux platform version 1.3.0 or later.

  • Windows platform version 1.0.0 or later.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dependson

Return type

Union[IResolvable, List[Union[IResolvable, ContainerDependencyProperty]], None]

disable_networking

When this parameter is true, networking is disabled within the container.

This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API . .. epigraph:

This parameter is not supported for Windows containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-disablenetworking

Return type

Union[bool, IResolvable, None]

dns_search_domains

A list of DNS search domains that are presented to the container.

This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run . .. epigraph:

This parameter is not supported for Windows containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dnssearchdomains

Return type

Optional[List[str]]

dns_servers

A list of DNS servers that are presented to the container.

This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run . .. epigraph:

This parameter is not supported for Windows containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dnsservers

Return type

Optional[List[str]]

docker_labels

A key/value map of labels to add to the container.

This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run . This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dockerlabels

Return type

Union[IResolvable, Mapping[str, str], None]

docker_security_options

A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.

This field isn’t valid for containers in tasks using the Fargate launch type.

With Windows containers, this parameter can be used to reference a credential spec file when configuring a container for Active Directory authentication. For more information, see Using gMSAs for Windows Containers in the Amazon Elastic Container Service Developer Guide .

This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run . .. epigraph:

The Amazon ECS container agent running on a container instance must register with the ``ECS_SELINUX_CAPABLE=true`` or ``ECS_APPARMOR_CAPABLE=true`` environment variables before containers placed on that instance can use these security options. For more information, see `Amazon ECS Container Agent Configuration <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html>`_ in the *Amazon Elastic Container Service Developer Guide* .

For more information about valid values, see Docker Run Security Configuration .

Valid values: “no-new-privileges” | “apparmor:PROFILE” | “label:value” | “credentialspec:CredentialSpecFilePath”

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dockersecurityoptions

Return type

Optional[List[str]]

entry_point

Early versions of the Amazon ECS container agent don’t properly handle entryPoint parameters.

If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead.

The entry point that’s passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#entrypoint .

link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-entrypoint

Return type

Optional[List[str]]

environment

The environment variables to pass to a container.

This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run . .. epigraph:

We don't recommend that you use plaintext environment variables for sensitive information, such as credential data.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-environment

Return type

Union[IResolvable, List[Union[IResolvable, KeyValuePairProperty]], None]

environment_files

A list of files containing the environment variables to pass to a container.

This parameter maps to the --env-file option to docker run .

You can specify up to ten environment files. The file must have a .env file extension. Each line in an environment file contains an environment variable in VARIABLE=VALUE format. Lines beginning with # are treated as comments and are ignored. For more information about the environment variable file syntax, see Declare default environment variables in file .

If there are environment variables specified using the environment parameter in a container definition, they take precedence over the variables contained within an environment file. If multiple environment files are specified that contain the same variable, they’re processed from the top down. We recommend that you use unique variable names. For more information, see Specifying Environment Variables in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-environmentfiles

Return type

Union[IResolvable, List[Union[IResolvable, EnvironmentFileProperty]], None]

essential

If the essential parameter of a container is marked as true , and that container fails or stops for any reason, all other containers that are part of the task are stopped.

If the essential parameter of a container is marked as false , its failure doesn’t affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

All tasks must have at least one essential container. If you have an application that’s composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-essential

Return type

Union[bool, IResolvable, None]

extra_hosts

A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.

This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run . .. epigraph:

This parameter isn't supported for Windows containers or tasks that use the ``awsvpc`` network mode.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-extrahosts

Return type

Union[IResolvable, List[Union[IResolvable, HostEntryProperty]], None]

firelens_configuration

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-firelensconfiguration

Return type

Union[IResolvable, FirelensConfigurationProperty, None]

health_check

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

This parameter maps to HealthCheck in the Create a container section of the Docker Remote API and the HEALTHCHECK parameter of docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-healthcheck

Return type

Union[IResolvable, HealthCheckProperty, None]

hostname

The hostname to use for your container.

This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run . .. epigraph:

The ``hostname`` parameter is not supported if you're using the ``awsvpc`` network mode.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-hostname

Return type

Optional[str]

image

The image used to start a container.

This string is passed directly to the Docker daemon. By default, images in the Docker Hub registry are available. Other repositories are specified with either *repository-url* / *image* : *tag* or *repository-url* / *image* @ *digest* . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run .

  • When a new task starts, the Amazon ECS container agent pulls the latest version of the specified image and tag for the container to use. However, subsequent updates to a repository image aren’t propagated to already running tasks.

  • Images in Amazon ECR repositories can be specified by either using the full registry/repository:tag or registry/repository@digest . For example, 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>:latest or 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>@sha256:94afd1f2e64d908bc90dbca0035a5b567EXAMPLE .

  • Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ).

  • Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ).

  • Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-image

Return type

Optional[str]

interactive

When this parameter is true , you can deploy containerized applications that require stdin or a tty to be allocated.

This parameter maps to OpenStdin in the Create a container section of the Docker Remote API and the --interactive option to docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-interactive

Return type

Union[bool, IResolvable, None]

The links parameter allows containers to communicate with each other without the need for port mappings.

This parameter is only supported if the network mode of a task definition is bridge . The name:internalName construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. For more information about linking Docker containers, go to Legacy container links in the Docker documentation. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run . .. epigraph:

This parameter is not supported for Windows containers. > Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-links

Return type

Optional[List[str]]

linux_parameters

//docs.aws.amazon.com/AmazonECS/latest/APIReference/API_KernelCapabilities.html>`_ .

This parameter is not supported for Windows containers.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-linuxparameters

Type

Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information see `KernelCapabilities <https

Return type

Union[LinuxParametersProperty, IResolvable, None]

log_configuration

The log configuration specification for the container.

This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run . By default, containers use the same logging driver that the Docker daemon uses. However, the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation. .. epigraph:

Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the `LogConfiguration <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html>`_ data type). Additional log drivers may be available in future releases of the Amazon ECS container agent.

This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}' .. epigraph:

The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ``ECS_AVAILABLE_LOGGING_DRIVERS`` environment variable before containers placed on that instance can use these log configuration options. For more information, see `Amazon ECS Container Agent Configuration <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html>`_ in the *Amazon Elastic Container Service Developer Guide* .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration

Return type

Union[IResolvable, LogConfigurationProperty, None]

memory

The amount (in MiB) of memory to present to the container.

If your container attempts to exceed the memory specified here, the container is killed. The total amount of memory reserved for all containers within a task must be lower than the task memory value, if one is specified. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run .

If using the Fargate launch type, this parameter is optional.

If using the EC2 launch type, you must specify either a task-level memory value or a container-level memory value. If you specify both a container-level memory and memoryReservation value, memory must be greater than memoryReservation . If you specify memoryReservation , then that value is subtracted from the available memory resources for the container instance where the container is placed. Otherwise, the value of memory is used.

The Docker 20.10.0 or later daemon reserves a minimum of 6 MiB of memory for a container, so you should not specify fewer than 6 MiB of memory for your containers.

The Docker 19.03.13-ce or earlier daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-memory

Return type

Union[int, float, None]

memory_reservation

The soft limit (in MiB) of memory to reserve for the container.

When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first. This parameter maps to MemoryReservation in the Create a container section of the Docker Remote API and the --memory-reservation option to docker run .

If a task-level memory value is not specified, you must specify a non-zero integer for one or both of memory or memoryReservation in a container definition. If you specify both, memory must be greater than memoryReservation . If you specify memoryReservation , then that value is subtracted from the available memory resources for the container instance where the container is placed. Otherwise, the value of memory is used.

For example, if your container normally uses 128 MiB of memory, but occasionally bursts to 256 MiB of memory for short periods of time, you can set a memoryReservation of 128 MiB, and a memory hard limit of 300 MiB. This configuration would allow the container to only reserve 128 MiB of memory from the remaining resources on the container instance, but also allow the container to consume more memory resources when needed.

The Docker daemon reserves a minimum of 4 MiB of memory for a container. Therefore, we recommend that you specify fewer than 4 MiB of memory for your containers.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-memoryreservation

Return type

Union[int, float, None]

mount_points

The mount points for data volumes in your container.

This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run .

Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can’t mount directories on a different drive, and mount point can’t be across drives.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints

Return type

Union[IResolvable, List[Union[IResolvable, MountPointProperty]], None]

name

The name of a container.

If you’re linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-name

Return type

Optional[str]

port_mappings

The list of port mappings for the container.

Port mappings allow containers to access ports on the host container instance to send or receive traffic.

For task definitions that use the awsvpc network mode, you should only specify the containerPort . The hostPort can be left blank or it must be the same value as the containerPort .

Port mappings on Windows use the NetNAT gateway address rather than localhost . There is no loopback for port mappings on Windows, so you cannot access a container’s mapped port from the host itself.

This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run . If the network mode of a task definition is set to none , then you can’t specify port mappings. If the network mode of a task definition is set to host , then host ports must either be undefined or they must match the container port in the port mapping. .. epigraph:

After a task reaches the ``RUNNING`` status, manual and automatic host and container port assignments are visible in the *Network Bindings* section of a container description for a selected task in the Amazon ECS console. The assignments are also visible in the ``networkBindings`` section `DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_ responses.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-portmappings

Return type

Union[IResolvable, List[Union[IResolvable, PortMappingProperty]], None]

privileged

When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).

This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run . .. epigraph:

This parameter is not supported for Windows containers or tasks run on AWS Fargate .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-privileged

Return type

Union[bool, IResolvable, None]

pseudo_terminal

When this parameter is true , a TTY is allocated.

This parameter maps to Tty in the Create a container section of the Docker Remote API and the --tty option to docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-pseudoterminal

Return type

Union[bool, IResolvable, None]

readonly_root_filesystem

When this parameter is true, the container is given read-only access to its root file system.

This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run . .. epigraph:

This parameter is not supported for Windows containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-readonlyrootfilesystem

Return type

Union[bool, IResolvable, None]

repository_credentials

The private repository authentication credentials to use.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-repositorycredentials

Return type

Union[RepositoryCredentialsProperty, IResolvable, None]

resource_requirements

The type and amount of a resource to assign to a container.

The only supported resource is a GPU.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-resourcerequirements

Return type

Union[IResolvable, List[Union[IResolvable, ResourceRequirementProperty]], None]

secrets

The secrets to pass to the container.

For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-secrets

Return type

Union[IResolvable, List[Union[SecretProperty, IResolvable]], None]

start_timeout

Time duration (in seconds) to wait before giving up on resolving dependencies for a container.

For example, you specify two containers in a task definition with containerA having a dependency on containerB reaching a COMPLETE , SUCCESS , or HEALTHY status. If a startTimeout value is specified for containerB and it doesn’t reach the desired status within that time then containerA gives up and not start. This results in the task transitioning to a STOPPED state. .. epigraph:

When the ``ECS_CONTAINER_START_TIMEOUT`` container agent configuration variable is used, it's enforced independently from this start timeout value.

For tasks using the Fargate launch type, the task or service requires the following platforms:

  • Linux platform version 1.3.0 or later.

  • Windows platform version 1.0.0 or later.

For tasks using the EC2 launch type, your container instances require at least version 1.26.0 of the container agent to use a container start timeout value. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-starttimeout

Return type

Union[int, float, None]

stop_timeout

Time duration (in seconds) to wait before the container is forcefully killed if it doesn’t exit normally on its own.

For tasks using the Fargate launch type, the task or service requires the following platforms:

  • Linux platform version 1.3.0 or later.

  • Windows platform version 1.0.0 or later.

The max stop timeout value is 120 seconds and if the parameter is not specified, the default value of 30 seconds is used.

For tasks that use the EC2 launch type, if the stopTimeout parameter isn’t specified, the value set for the Amazon ECS container agent configuration variable ECS_CONTAINER_STOP_TIMEOUT is used. If neither the stopTimeout parameter or the ECS_CONTAINER_STOP_TIMEOUT agent configuration variable are set, then the default values of 30 seconds for Linux containers and 30 seconds on Windows containers are used. Your container instances require at least version 1.26.0 of the container agent to use a container stop timeout value. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you’re using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-stoptimeout

Return type

Union[int, float, None]

system_controls

A list of namespaced kernel parameters to set in the container.

This parameter maps to Sysctls in the Create a container section of the Docker Remote API and the --sysctl option to docker run . .. epigraph:

We don't recommended that you specify network-related ``systemControls`` parameters for multiple containers in a single task that also uses either the ``awsvpc`` or ``host`` network modes. For tasks that use the ``awsvpc`` network mode, the container that's started last determines which ``systemControls`` parameters take effect. For tasks that use the ``host`` network mode, it changes the container instance's namespaced kernel parameters as well as the containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-systemcontrols

Return type

Union[IResolvable, List[Union[IResolvable, SystemControlProperty]], None]

ulimits

A list of ulimits to set in the container.

This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run . Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}' .. epigraph:

This parameter is not supported for Windows containers.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-ulimits

Return type

Union[IResolvable, List[Union[IResolvable, UlimitProperty]], None]

user

The user to use inside the container.

This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run . .. epigraph:

When running tasks using the ``host`` network mode, don't run containers using the root user (UID 0). We recommend using a non-root user for better security.

You can specify the user using the following formats. If specifying a UID or GID, you must specify it as a positive integer.

  • user

  • user:group

  • uid

  • uid:gid

  • user:gid

  • uid:group

This parameter is not supported for Windows containers.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-user

Return type

Optional[str]

volumes_from

Data volumes to mount from another container.

This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom

Return type

Union[IResolvable, List[Union[IResolvable, VolumeFromProperty]], None]

working_directory

The working directory to run commands inside the container in.

This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-workingdirectory

Return type

Optional[str]

ContainerDependencyProperty

class CfnTaskDefinition.ContainerDependencyProperty(*, condition=None, container_name=None)

Bases: object

The ContainerDependency property specifies the dependencies defined for container startup and shutdown.

A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed.

Your Amazon ECS container instances require at least version 1.26.0 of the container agent to enable container dependencies. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide . If you are using an Amazon ECS-optimized Linux AMI, your instance needs at least version 1.26.0-1 of the ecs-init package. If your container instances are launched from version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide . .. epigraph:

For tasks using the Fargate launch type, this parameter requires that the task or service uses platform version 1.3.0 or later.
Parameters
  • condition (Optional[str]) – The dependency condition of the container. The following are the available conditions and their behavior:. - START - This condition emulates the behavior of links and volumes today. It validates that a dependent container is started before permitting other containers to start. - COMPLETE - This condition validates that a dependent container runs to completion (exits) before permitting other containers to start. This can be useful for nonessential containers that run a script and then exit. This condition can’t be set on an essential container. - SUCCESS - This condition is the same as COMPLETE , but it also requires that the container exits with a zero status. This condition can’t be set on an essential container. - HEALTHY - This condition validates that the dependent container passes its Docker health check before permitting other containers to start. This requires that the dependent container has health checks configured. This condition is confirmed only at task startup.

  • container_name (Optional[str]) – The name of a container.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

container_dependency_property = ecs.CfnTaskDefinition.ContainerDependencyProperty(
    condition="condition",
    container_name="containerName"
)

Attributes

condition

.

  • START - This condition emulates the behavior of links and volumes today. It validates that a dependent container is started before permitting other containers to start.

  • COMPLETE - This condition validates that a dependent container runs to completion (exits) before permitting other containers to start. This can be useful for nonessential containers that run a script and then exit. This condition can’t be set on an essential container.

  • SUCCESS - This condition is the same as COMPLETE , but it also requires that the container exits with a zero status. This condition can’t be set on an essential container.

  • HEALTHY - This condition validates that the dependent container passes its Docker health check before permitting other containers to start. This requires that the dependent container has health checks configured. This condition is confirmed only at task startup.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdependency.html#cfn-ecs-taskdefinition-containerdependency-condition

Type

The dependency condition of the container. The following are the available conditions and their behavior

Return type

Optional[str]

container_name

The name of a container.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdependency.html#cfn-ecs-taskdefinition-containerdependency-containername

Return type

Optional[str]

DeviceProperty

class CfnTaskDefinition.DeviceProperty(*, container_path=None, host_path=None, permissions=None)

Bases: object

The Device property specifies an object representing a container instance host device.

Parameters
  • container_path (Optional[str]) – The path inside the container at which to expose the host device.

  • host_path (Optional[str]) – The path for the device on the host container instance.

  • permissions (Optional[Sequence[str]]) – The explicit permissions to provide to the container for the device. By default, the container has permissions for read , write , and mknod for the device.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

device_property = ecs.CfnTaskDefinition.DeviceProperty(
    container_path="containerPath",
    host_path="hostPath",
    permissions=["permissions"]
)

Attributes

container_path

The path inside the container at which to expose the host device.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-containerpath

Return type

Optional[str]

host_path

The path for the device on the host container instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-hostpath

Return type

Optional[str]

permissions

The explicit permissions to provide to the container for the device.

By default, the container has permissions for read , write , and mknod for the device.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-permissions

Return type

Optional[List[str]]

DockerVolumeConfigurationProperty

class CfnTaskDefinition.DockerVolumeConfigurationProperty(*, autoprovision=None, driver=None, driver_opts=None, labels=None, scope=None)

Bases: object

The DockerVolumeConfiguration property specifies a Docker volume configuration and is used when you use Docker volumes.

Docker volumes are only supported when you are using the EC2 launch type. Windows containers only support the use of the local driver. To use bind mounts, specify a host instead.

Parameters
  • autoprovision (Union[bool, IResolvable, None]) – If this value is true , the Docker volume is created if it doesn’t already exist. .. epigraph:: This field is only used if the scope is shared .

  • driver (Optional[str]) –

    The Docker volume driver to use. The driver value must match the driver name provided by Docker because it is used for task placement. If the driver was installed using the Docker plugin CLI, use docker plugin ls to retrieve the driver name from your container instance. If the driver was installed using another method, use Docker plugin discovery to retrieve the driver name. For more information, see Docker plugin discovery . This parameter maps to Driver in the Create a volume section of the Docker Remote API and the xxdriver option to docker volume create .

  • driver_opts (Union[IResolvable, Mapping[str, str], None]) –

    A map of Docker driver-specific options passed through. This parameter maps to DriverOpts in the Create a volume section of the Docker Remote API and the xxopt option to docker volume create .

  • labels (Union[IResolvable, Mapping[str, str], None]) –

    Custom metadata to add to your Docker volume. This parameter maps to Labels in the Create a volume section of the Docker Remote API and the xxlabel option to docker volume create .

  • scope (Optional[str]) – The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a task are automatically provisioned when the task starts and destroyed when the task stops. Docker volumes that are scoped as shared persist after the task stops.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

docker_volume_configuration_property = ecs.CfnTaskDefinition.DockerVolumeConfigurationProperty(
    autoprovision=False,
    driver="driver",
    driver_opts={
        "driver_opts_key": "driverOpts"
    },
    labels={
        "labels_key": "labels"
    },
    scope="scope"
)

Attributes

autoprovision

If this value is true , the Docker volume is created if it doesn’t already exist.

This field is only used if the scope is shared .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-dockervolumeconfiguration.html#cfn-ecs-taskdefinition-dockervolumeconfiguration-autoprovision

Return type

Union[bool, IResolvable, None]

driver

The Docker volume driver to use.

The driver value must match the driver name provided by Docker because it is used for task placement. If the driver was installed using the Docker plugin CLI, use docker plugin ls to retrieve the driver name from your container instance. If the driver was installed using another method, use Docker plugin discovery to retrieve the driver name. For more information, see Docker plugin discovery . This parameter maps to Driver in the Create a volume section of the Docker Remote API and the xxdriver option to docker volume create .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-dockervolumeconfiguration.html#cfn-ecs-taskdefinition-dockervolumeconfiguration-driver

Return type

Optional[str]

driver_opts

A map of Docker driver-specific options passed through.

This parameter maps to DriverOpts in the Create a volume section of the Docker Remote API and the xxopt option to docker volume create .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-dockervolumeconfiguration.html#cfn-ecs-taskdefinition-dockervolumeconfiguration-driveropts

Return type

Union[IResolvable, Mapping[str, str], None]

labels

Custom metadata to add to your Docker volume.

This parameter maps to Labels in the Create a volume section of the Docker Remote API and the xxlabel option to docker volume create .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-dockervolumeconfiguration.html#cfn-ecs-taskdefinition-dockervolumeconfiguration-labels

Return type

Union[IResolvable, Mapping[str, str], None]

scope

The scope for the Docker volume that determines its lifecycle.

Docker volumes that are scoped to a task are automatically provisioned when the task starts and destroyed when the task stops. Docker volumes that are scoped as shared persist after the task stops.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-dockervolumeconfiguration.html#cfn-ecs-taskdefinition-dockervolumeconfiguration-scope

Return type

Optional[str]

EFSVolumeConfigurationProperty

class CfnTaskDefinition.EFSVolumeConfigurationProperty(*, filesystem_id, authorization_config=None, root_directory=None, transit_encryption=None, transit_encryption_port=None)

Bases: object

This parameter is specified when you’re using an Amazon Elastic File System file system for task storage.

For more information, see Amazon EFS volumes in the Amazon Elastic Container Service Developer Guide .

Parameters
  • filesystem_id (str) – The Amazon EFS file system ID to use.

  • authorization_config (Union[IResolvable, AuthorizationConfigProperty, Dict[str, Any], None]) – The authorization configuration details for the Amazon EFS file system.

  • root_directory (Optional[str]) – The directory within the Amazon EFS file system to mount as the root directory inside the host. If this parameter is omitted, the root of the Amazon EFS volume will be used. Specifying / will have the same effect as omitting this parameter. .. epigraph:: If an EFS access point is specified in the authorizationConfig , the root directory parameter must either be omitted or set to / which will enforce the path set on the EFS access point.

  • transit_encryption (Optional[str]) – Determines whether to use encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server. Transit encryption must be enabled if Amazon EFS IAM authorization is used. If this parameter is omitted, the default value of DISABLED is used. For more information, see Encrypting data in transit in the Amazon Elastic File System User Guide .

  • transit_encryption_port (Union[int, float, None]) – The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server. If you do not specify a transit encryption port, it will use the port selection strategy that the Amazon EFS mount helper uses. For more information, see EFS mount helper in the Amazon Elastic File System User Guide .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

e_fSVolume_configuration_property = ecs.CfnTaskDefinition.EFSVolumeConfigurationProperty(
    filesystem_id="filesystemId",

    # the properties below are optional
    authorization_config=ecs.CfnTaskDefinition.AuthorizationConfigProperty(
        access_point_id="accessPointId",
        iam="iam"
    ),
    root_directory="rootDirectory",
    transit_encryption="transitEncryption",
    transit_encryption_port=123
)

Attributes

authorization_config

The authorization configuration details for the Amazon EFS file system.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-efsvolumeconfiguration.html#cfn-ecs-taskdefinition-efsvolumeconfiguration-authorizationconfig

Return type

Union[IResolvable, AuthorizationConfigProperty, None]

filesystem_id

The Amazon EFS file system ID to use.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-efsvolumeconfiguration.html#cfn-ecs-taskdefinition-efsvolumeconfiguration-filesystemid

Return type

str

root_directory

The directory within the Amazon EFS file system to mount as the root directory inside the host.

If this parameter is omitted, the root of the Amazon EFS volume will be used. Specifying / will have the same effect as omitting this parameter. .. epigraph:

If an EFS access point is specified in the ``authorizationConfig`` , the root directory parameter must either be omitted or set to ``/`` which will enforce the path set on the EFS access point.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-efsvolumeconfiguration.html#cfn-ecs-taskdefinition-efsvolumeconfiguration-rootdirectory

Return type

Optional[str]

transit_encryption

Determines whether to use encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server.

Transit encryption must be enabled if Amazon EFS IAM authorization is used. If this parameter is omitted, the default value of DISABLED is used. For more information, see Encrypting data in transit in the Amazon Elastic File System User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-efsvolumeconfiguration.html#cfn-ecs-taskdefinition-efsvolumeconfiguration-transitencryption

Return type

Optional[str]

transit_encryption_port

The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server.

If you do not specify a transit encryption port, it will use the port selection strategy that the Amazon EFS mount helper uses. For more information, see EFS mount helper in the Amazon Elastic File System User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-efsvolumeconfiguration.html#cfn-ecs-taskdefinition-efsvolumeconfiguration-transitencryptionport

Return type

Union[int, float, None]

EnvironmentFileProperty

class CfnTaskDefinition.EnvironmentFileProperty(*, type=None, value=None)

Bases: object

A list of files containing the environment variables to pass to a container.

You can specify up to ten environment files. The file must have a .env file extension. Each line in an environment file should contain an environment variable in VARIABLE=VALUE format. Lines beginning with # are treated as comments and are ignored. For more information about the environment variable file syntax, see Declare default environment variables in file .

If there are environment variables specified using the environment parameter in a container definition, they take precedence over the variables contained within an environment file. If multiple environment files are specified that contain the same variable, they’re processed from the top down. We recommend that you use unique variable names. For more information, see Specifying environment variables in the Amazon Elastic Container Service Developer Guide .

This parameter is only supported for tasks hosted on Fargate using the following platform versions:

  • Linux platform version 1.4.0 or later.

  • Windows platform version 1.0.0 or later.

Parameters
  • type (Optional[str]) – The file type to use. The only supported value is s3 .

  • value (Optional[str]) – The Amazon Resource Name (ARN) of the Amazon S3 object containing the environment variable file.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

environment_file_property = ecs.CfnTaskDefinition.EnvironmentFileProperty(
    type="type",
    value="value"
)

Attributes

type

The file type to use.

The only supported value is s3 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-environmentfile.html#cfn-ecs-taskdefinition-environmentfile-type

Return type

Optional[str]

value

The Amazon Resource Name (ARN) of the Amazon S3 object containing the environment variable file.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-environmentfile.html#cfn-ecs-taskdefinition-environmentfile-value

Return type

Optional[str]

EphemeralStorageProperty

class CfnTaskDefinition.EphemeralStorageProperty(*, size_in_gib=None)

Bases: object

The amount of ephemeral storage to allocate for the task.

This parameter is used to expand the total amount of ephemeral storage available, beyond the default amount, for tasks hosted on AWS Fargate . For more information, see Fargate task storage in the Amazon ECS User Guide for AWS Fargate . .. epigraph:

This parameter is only supported for tasks hosted on Fargate using Linux platform version ``1.4.0`` or later. This parameter is not supported for Windows containers on Fargate.
Parameters

size_in_gib (Union[int, float, None]) – The total amount, in GiB, of ephemeral storage to set for the task. The minimum supported value is 21 GiB and the maximum supported value is 200 GiB.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

ephemeral_storage_property = ecs.CfnTaskDefinition.EphemeralStorageProperty(
    size_in_gi_b=123
)

Attributes

size_in_gib

The total amount, in GiB, of ephemeral storage to set for the task.

The minimum supported value is 21 GiB and the maximum supported value is 200 GiB.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-ephemeralstorage.html#cfn-ecs-taskdefinition-ephemeralstorage-sizeingib

Return type

Union[int, float, None]

FirelensConfigurationProperty

class CfnTaskDefinition.FirelensConfigurationProperty(*, options=None, type=None)

Bases: object

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 .

Parameters
  • options (Union[IResolvable, Mapping[str, str], None]) – The options to use when configuring the log router. This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event. If specified, valid option keys are: - enable-ecs-log-metadata , which can be true or false - config-file-type , which can be s3 or file - config-file-value , which is either an S3 ARN or a file path

  • type (Optional[str]) – The log router to use. The valid values are fluentd or fluentbit .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

firelens_configuration_property = ecs.CfnTaskDefinition.FirelensConfigurationProperty(
    options={
        "options_key": "options"
    },
    type="type"
)

Attributes

options

The options to use when configuring the log router.

This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event.

If specified, valid option keys are:

  • enable-ecs-log-metadata , which can be true or false

  • config-file-type , which can be s3 or file

  • config-file-value , which is either an S3 ARN or a file path

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-firelensconfiguration.html#cfn-ecs-taskdefinition-firelensconfiguration-options

Return type

Union[IResolvable, Mapping[str, str], None]

type

The log router to use.

The valid values are fluentd or fluentbit .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-firelensconfiguration.html#cfn-ecs-taskdefinition-firelensconfiguration-type

Return type

Optional[str]

HealthCheckProperty

class CfnTaskDefinition.HealthCheckProperty(*, command=None, interval=None, retries=None, start_period=None, timeout=None)

Bases: object

The HealthCheck property specifies 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).

The following are notes about container health check support:

  • Container health checks require version 1.17.0 or 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 are using platform version 1.1.0 or greater. For more information, see AWS Fargate Platform Versions .

  • Container health checks are not supported for tasks that are part of a service that is configured to use a Classic Load Balancer.

Parameters
  • command (Optional[Sequence[str]]) –

    A string array representing the command that the container runs to determine if it is healthy. 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. When you use the AWS Management Console JSON panel, the AWS Command Line Interface , or the APIs, enclose the list of commands in brackets. [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ] You don’t need to include the brackets when you use the AWS Management Console. "CMD-SHELL", "curl -f http://localhost/ || exit 1" An exit code of 0 indicates success, and non-zero exit code indicates failure. For more information, see HealthCheck in the Create a container section of the Docker Remote API .

  • interval (Union[int, float, None]) – The time period in seconds between each health check execution. You may specify between 5 and 300 seconds. The default value is 30 seconds.

  • retries (Union[int, float, None]) – The number of times to retry a failed health check before the container is considered unhealthy. You may specify between 1 and 10 retries. The default value is 3.

  • start_period (Union[int, float, None]) – The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries. You can specify between 0 and 300 seconds. By default, the startPeriod is disabled. .. epigraph:: If a health check succeeds within the startPeriod , then the container is considered healthy and any subsequent failures count toward the maximum number of retries.

  • timeout (Union[int, float, None]) – The time period in seconds to wait for a health check to succeed before it is considered a failure. You may specify between 2 and 60 seconds. The default value is 5.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

health_check_property = ecs.CfnTaskDefinition.HealthCheckProperty(
    command=["command"],
    interval=123,
    retries=123,
    start_period=123,
    timeout=123
)

Attributes

command

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

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.

When you use the AWS Management Console JSON panel, the AWS Command Line Interface , or the APIs, enclose the list of commands in brackets.

[ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ]

You don’t need to include the brackets when you use the AWS Management Console.

"CMD-SHELL", "curl -f http://localhost/ || exit 1"

An exit code of 0 indicates success, and non-zero exit code indicates failure. For more information, see HealthCheck in the Create a container section of the Docker Remote API .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-command

Return type

Optional[List[str]]

interval

The time period in seconds between each health check execution.

You may specify between 5 and 300 seconds. The default value is 30 seconds.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-interval

Return type

Union[int, float, None]

retries

The number of times to retry a failed health check before the container is considered unhealthy.

You may specify between 1 and 10 retries. The default value is 3.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-retries

Return type

Union[int, float, None]

start_period

The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

You can specify between 0 and 300 seconds. By default, the startPeriod is disabled. .. epigraph:

If a health check succeeds within the ``startPeriod`` , then the container is considered healthy and any subsequent failures count toward the maximum number of retries.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-startperiod

Return type

Union[int, float, None]

timeout

The time period in seconds to wait for a health check to succeed before it is considered a failure.

You may specify between 2 and 60 seconds. The default value is 5.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-timeout

Return type

Union[int, float, None]

HostEntryProperty

class CfnTaskDefinition.HostEntryProperty(*, hostname=None, ip_address=None)

Bases: object

The HostEntry property specifies a hostname and an IP address that are added to the /etc/hosts file of a container through the extraHosts parameter of its ContainerDefinition resource.

Parameters
  • hostname (Optional[str]) – The hostname to use in the /etc/hosts entry.

  • ip_address (Optional[str]) – The IP address to use in the /etc/hosts entry.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

host_entry_property = ecs.CfnTaskDefinition.HostEntryProperty(
    hostname="hostname",
    ip_address="ipAddress"
)

Attributes

hostname

The hostname to use in the /etc/hosts entry.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-hostentry.html#cfn-ecs-taskdefinition-containerdefinition-hostentry-hostname

Return type

Optional[str]

ip_address

The IP address to use in the /etc/hosts entry.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-hostentry.html#cfn-ecs-taskdefinition-containerdefinition-hostentry-ipaddress

Return type

Optional[str]

HostVolumePropertiesProperty

class CfnTaskDefinition.HostVolumePropertiesProperty(*, source_path=None)

Bases: object

The HostVolumeProperties property specifies details on a container instance bind mount host volume.

Parameters

source_path (Optional[str]) – When the host parameter is used, specify a sourcePath to declare the path on the host container instance that’s presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value doesn’t exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported. If you’re using the Fargate launch type, the sourcePath parameter is not supported.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

host_volume_properties_property = ecs.CfnTaskDefinition.HostVolumePropertiesProperty(
    source_path="sourcePath"
)

Attributes

source_path

When the host parameter is used, specify a sourcePath to declare the path on the host container instance that’s presented to the container.

If this parameter is empty, then the Docker daemon has assigned a host path for you. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value doesn’t exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported.

If you’re using the Fargate launch type, the sourcePath parameter is not supported.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes-host.html#cfn-ecs-taskdefinition-volumes-host-sourcepath

Return type

Optional[str]

InferenceAcceleratorProperty

class CfnTaskDefinition.InferenceAcceleratorProperty(*, device_name=None, device_type=None)

Bases: object

Details on an Elastic Inference accelerator.

For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide .

Parameters
  • device_name (Optional[str]) – The Elastic Inference accelerator device name. The deviceName must also be referenced in a container definition as a ResourceRequirement .

  • device_type (Optional[str]) – The Elastic Inference accelerator type to use.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

inference_accelerator_property = ecs.CfnTaskDefinition.InferenceAcceleratorProperty(
    device_name="deviceName",
    device_type="deviceType"
)

Attributes

device_name

The Elastic Inference accelerator device name.

The deviceName must also be referenced in a container definition as a ResourceRequirement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-inferenceaccelerator.html#cfn-ecs-taskdefinition-inferenceaccelerator-devicename

Return type

Optional[str]

device_type

The Elastic Inference accelerator type to use.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-inferenceaccelerator.html#cfn-ecs-taskdefinition-inferenceaccelerator-devicetype

Return type

Optional[str]

KernelCapabilitiesProperty

class CfnTaskDefinition.KernelCapabilitiesProperty(*, add=None, drop=None)

Bases: object

The KernelCapabilities property specifies the Linux capabilities for the container that are added to or dropped from the default configuration that is provided by Docker.

For more information on the default capabilities and the non-default available capabilities, see Runtime privilege and Linux capabilities in the Docker run reference . For more detailed information on these Linux capabilities, see the capabilities(7) Linux manual page.

Parameters
  • add (Optional[Sequence[str]]) –

    The Linux capabilities for the container that have been added to the default configuration provided by Docker. This parameter maps to CapAdd in the Create a container section of the Docker Remote API and the --cap-add option to docker run . .. epigraph:: Tasks launched on AWS Fargate only support adding the SYS_PTRACE kernel capability. Valid values: "ALL" | "AUDIT_CONTROL" | "AUDIT_WRITE" | "BLOCK_SUSPEND" | "CHOWN" | "DAC_OVERRIDE" | "DAC_READ_SEARCH" | "FOWNER" | "FSETID" | "IPC_LOCK" | "IPC_OWNER" | "KILL" | "LEASE" | "LINUX_IMMUTABLE" | "MAC_ADMIN" | "MAC_OVERRIDE" | "MKNOD" | "NET_ADMIN" | "NET_BIND_SERVICE" | "NET_BROADCAST" | "NET_RAW" | "SETFCAP" | "SETGID" | "SETPCAP" | "SETUID" | "SYS_ADMIN" | "SYS_BOOT" | "SYS_CHROOT" | "SYS_MODULE" | "SYS_NICE" | "SYS_PACCT" | "SYS_PTRACE" | "SYS_RAWIO" | "SYS_RESOURCE" | "SYS_TIME" | "SYS_TTY_CONFIG" | "SYSLOG" | "WAKE_ALARM"

  • drop (Optional[Sequence[str]]) –

    The Linux capabilities for the container that have been removed from the default configuration provided by Docker. This parameter maps to CapDrop in the Create a container section of the Docker Remote API and the --cap-drop option to docker run . Valid values: "ALL" | "AUDIT_CONTROL" | "AUDIT_WRITE" | "BLOCK_SUSPEND" | "CHOWN" | "DAC_OVERRIDE" | "DAC_READ_SEARCH" | "FOWNER" | "FSETID" | "IPC_LOCK" | "IPC_OWNER" | "KILL" | "LEASE" | "LINUX_IMMUTABLE" | "MAC_ADMIN" | "MAC_OVERRIDE" | "MKNOD" | "NET_ADMIN" | "NET_BIND_SERVICE" | "NET_BROADCAST" | "NET_RAW" | "SETFCAP" | "SETGID" | "SETPCAP" | "SETUID" | "SYS_ADMIN" | "SYS_BOOT" | "SYS_CHROOT" | "SYS_MODULE" | "SYS_NICE" | "SYS_PACCT" | "SYS_PTRACE" | "SYS_RAWIO" | "SYS_RESOURCE" | "SYS_TIME" | "SYS_TTY_CONFIG" | "SYSLOG" | "WAKE_ALARM"

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

kernel_capabilities_property = ecs.CfnTaskDefinition.KernelCapabilitiesProperty(
    add=["add"],
    drop=["drop"]
)

Attributes

add

The Linux capabilities for the container that have been added to the default configuration provided by Docker.

This parameter maps to CapAdd in the Create a container section of the Docker Remote API and the --cap-add option to docker run . .. epigraph:

Tasks launched on AWS Fargate only support adding the ``SYS_PTRACE`` kernel capability.

Valid values: "ALL" | "AUDIT_CONTROL" | "AUDIT_WRITE" | "BLOCK_SUSPEND" | "CHOWN" | "DAC_OVERRIDE" | "DAC_READ_SEARCH" | "FOWNER" | "FSETID" | "IPC_LOCK" | "IPC_OWNER" | "KILL" | "LEASE" | "LINUX_IMMUTABLE" | "MAC_ADMIN" | "MAC_OVERRIDE" | "MKNOD" | "NET_ADMIN" | "NET_BIND_SERVICE" | "NET_BROADCAST" | "NET_RAW" | "SETFCAP" | "SETGID" | "SETPCAP" | "SETUID" | "SYS_ADMIN" | "SYS_BOOT" | "SYS_CHROOT" | "SYS_MODULE" | "SYS_NICE" | "SYS_PACCT" | "SYS_PTRACE" | "SYS_RAWIO" | "SYS_RESOURCE" | "SYS_TIME" | "SYS_TTY_CONFIG" | "SYSLOG" | "WAKE_ALARM"

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-kernelcapabilities.html#cfn-ecs-taskdefinition-kernelcapabilities-add

Return type

Optional[List[str]]

drop

The Linux capabilities for the container that have been removed from the default configuration provided by Docker.

This parameter maps to CapDrop in the Create a container section of the Docker Remote API and the --cap-drop option to docker run .

Valid values: "ALL" | "AUDIT_CONTROL" | "AUDIT_WRITE" | "BLOCK_SUSPEND" | "CHOWN" | "DAC_OVERRIDE" | "DAC_READ_SEARCH" | "FOWNER" | "FSETID" | "IPC_LOCK" | "IPC_OWNER" | "KILL" | "LEASE" | "LINUX_IMMUTABLE" | "MAC_ADMIN" | "MAC_OVERRIDE" | "MKNOD" | "NET_ADMIN" | "NET_BIND_SERVICE" | "NET_BROADCAST" | "NET_RAW" | "SETFCAP" | "SETGID" | "SETPCAP" | "SETUID" | "SYS_ADMIN" | "SYS_BOOT" | "SYS_CHROOT" | "SYS_MODULE" | "SYS_NICE" | "SYS_PACCT" | "SYS_PTRACE" | "SYS_RAWIO" | "SYS_RESOURCE" | "SYS_TIME" | "SYS_TTY_CONFIG" | "SYSLOG" | "WAKE_ALARM"

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-kernelcapabilities.html#cfn-ecs-taskdefinition-kernelcapabilities-drop

Return type

Optional[List[str]]

KeyValuePairProperty

class CfnTaskDefinition.KeyValuePairProperty(*, name=None, value=None)

Bases: object

The KeyValuePair property specifies a key-value pair object.

Parameters
  • name (Optional[str]) – The name of the key-value pair. For environment variables, this is the name of the environment variable.

  • value (Optional[str]) – The value of the key-value pair. For environment variables, this is the value of the environment variable.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

key_value_pair_property = ecs.CfnTaskDefinition.KeyValuePairProperty(
    name="name",
    value="value"
)

Attributes

name

The name of the key-value pair.

For environment variables, this is the name of the environment variable.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html#cfn-ecs-taskdefinition-containerdefinition-environment-name

Return type

Optional[str]

value

The value of the key-value pair.

For environment variables, this is the value of the environment variable.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html#cfn-ecs-taskdefinition-containerdefinition-environment-value

Return type

Optional[str]

LinuxParametersProperty

class CfnTaskDefinition.LinuxParametersProperty(*, capabilities=None, devices=None, init_process_enabled=None, max_swap=None, shared_memory_size=None, swappiness=None, tmpfs=None)

Bases: object

The LinuxParameters property specifies Linux-specific options that are applied to the container, such as Linux KernelCapabilities .

Parameters
  • capabilities (Union[IResolvable, KernelCapabilitiesProperty, Dict[str, Any], None]) – The Linux capabilities for the container that are added to or dropped from the default configuration provided by Docker. .. epigraph:: For tasks that use the Fargate launch type, capabilities is supported for all platform versions but the add parameter is only supported if using platform version 1.4.0 or later.

  • devices (Union[IResolvable, Sequence[Union[IResolvable, DeviceProperty, Dict[str, Any]]], None]) –

    Any host devices to expose to the container. This parameter maps to Devices in the Create a container section of the Docker Remote API and the --device option to docker run . .. epigraph:: If you’re using tasks that use the Fargate launch type, the devices parameter isn’t supported.

  • init_process_enabled (Union[bool, IResolvable, None]) –

    Run an init process inside the container that forwards signals and reaps processes. This parameter maps to the --init option to docker run . This parameter requires version 1.25 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

  • max_swap (Union[int, float, None]) –

    The total amount of swap memory (in MiB) a container can use. This parameter will be translated to the --memory-swap option to docker run where the value would be the sum of the container memory plus the maxSwap value. If a maxSwap value of 0 is specified, the container will not use swap. Accepted values are 0 or any positive integer. If the maxSwap parameter is omitted, the container will use the swap configuration for the container instance it is running on. A maxSwap value must be set for the swappiness parameter to be used. .. epigraph:: If you’re using tasks that use the Fargate launch type, the maxSwap parameter isn’t supported.

  • shared_memory_size (Union[int, float, None]) –

    The value for the size (in MiB) of the /dev/shm volume. This parameter maps to the --shm-size option to docker run . .. epigraph:: If you are using tasks that use the Fargate launch type, the sharedMemorySize parameter is not supported.

  • swappiness (Union[int, float, None]) –

    This allows you to tune a container’s memory swappiness behavior. A swappiness value of 0 will cause swapping to not happen unless absolutely necessary. A swappiness value of 100 will cause pages to be swapped very aggressively. Accepted values are whole numbers between 0 and 100 . If the swappiness parameter is not specified, a default value of 60 is used. If a value is not specified for maxSwap then this parameter is ignored. This parameter maps to the --memory-swappiness option to docker run . .. epigraph:: If you’re using tasks that use the Fargate launch type, the swappiness parameter isn’t supported.

  • tmpfs (Union[IResolvable, Sequence[Union[IResolvable, TmpfsProperty, Dict[str, Any]]], None]) –

    The container path, mount options, and size (in MiB) of the tmpfs mount. This parameter maps to the --tmpfs option to docker run . .. epigraph:: If you’re using tasks that use the Fargate launch type, the tmpfs parameter isn’t supported.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

linux_parameters_property = ecs.CfnTaskDefinition.LinuxParametersProperty(
    capabilities=ecs.CfnTaskDefinition.KernelCapabilitiesProperty(
        add=["add"],
        drop=["drop"]
    ),
    devices=[ecs.CfnTaskDefinition.DeviceProperty(
        container_path="containerPath",
        host_path="hostPath",
        permissions=["permissions"]
    )],
    init_process_enabled=False,
    max_swap=123,
    shared_memory_size=123,
    swappiness=123,
    tmpfs=[ecs.CfnTaskDefinition.TmpfsProperty(
        size=123,

        # the properties below are optional
        container_path="containerPath",
        mount_options=["mountOptions"]
    )]
)

Attributes

capabilities

The Linux capabilities for the container that are added to or dropped from the default configuration provided by Docker.

For tasks that use the Fargate launch type, capabilities is supported for all platform versions but the add parameter is only supported if using platform version 1.4.0 or later.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-capabilities

Return type

Union[IResolvable, KernelCapabilitiesProperty, None]

devices

Any host devices to expose to the container.

This parameter maps to Devices in the Create a container section of the Docker Remote API and the --device option to docker run . .. epigraph:

If you're using tasks that use the Fargate launch type, the ``devices`` parameter isn't supported.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-devices

Return type

Union[IResolvable, List[Union[IResolvable, DeviceProperty]], None]

init_process_enabled

Run an init process inside the container that forwards signals and reaps processes.

This parameter maps to the --init option to docker run . This parameter requires version 1.25 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-initprocessenabled

Return type

Union[bool, IResolvable, None]

max_swap

The total amount of swap memory (in MiB) a container can use.

This parameter will be translated to the --memory-swap option to docker run where the value would be the sum of the container memory plus the maxSwap value.

If a maxSwap value of 0 is specified, the container will not use swap. Accepted values are 0 or any positive integer. If the maxSwap parameter is omitted, the container will use the swap configuration for the container instance it is running on. A maxSwap value must be set for the swappiness parameter to be used. .. epigraph:

If you're using tasks that use the Fargate launch type, the ``maxSwap`` parameter isn't supported.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-maxswap

Return type

Union[int, float, None]

shared_memory_size

The value for the size (in MiB) of the /dev/shm volume.

This parameter maps to the --shm-size option to docker run . .. epigraph:

If you are using tasks that use the Fargate launch type, the ``sharedMemorySize`` parameter is not supported.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-sharedmemorysize

Return type

Union[int, float, None]

swappiness

This allows you to tune a container’s memory swappiness behavior.

A swappiness value of 0 will cause swapping to not happen unless absolutely necessary. A swappiness value of 100 will cause pages to be swapped very aggressively. Accepted values are whole numbers between 0 and 100 . If the swappiness parameter is not specified, a default value of 60 is used. If a value is not specified for maxSwap then this parameter is ignored. This parameter maps to the --memory-swappiness option to docker run . .. epigraph:

If you're using tasks that use the Fargate launch type, the ``swappiness`` parameter isn't supported.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-swappiness

Return type

Union[int, float, None]

tmpfs

The container path, mount options, and size (in MiB) of the tmpfs mount.

This parameter maps to the --tmpfs option to docker run . .. epigraph:

If you're using tasks that use the Fargate launch type, the ``tmpfs`` parameter isn't supported.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-tmpfs

Return type

Union[IResolvable, List[Union[IResolvable, TmpfsProperty]], None]

LogConfigurationProperty

class CfnTaskDefinition.LogConfigurationProperty(*, log_driver, options=None, secret_options=None)

Bases: object

The LogConfiguration property specifies log configuration options to send to a custom log driver for the container.

Parameters
  • log_driver (str) –

    The log driver to use for the container. For tasks on AWS Fargate , the supported log drivers are awslogs , splunk , and awsfirelens . For tasks hosted on Amazon EC2 instances, the supported log drivers are awslogs , fluentd , gelf , json-file , journald , logentries , syslog , splunk , and awsfirelens . For more information about using the awslogs log driver, see Using the awslogs log driver in the Amazon Elastic Container Service Developer Guide . For more information about using the awsfirelens log driver, see Custom log routing in the Amazon Elastic Container Service Developer Guide . .. epigraph:: If you have a custom driver that isn’t listed, you can fork the Amazon ECS container agent project that’s available on GitHub and customize it to work with that driver. We encourage you to submit pull requests for changes that you would like to have included. However, we don’t currently provide support for running modified copies of this software.

  • options (Union[IResolvable, Mapping[str, str], None]) – The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

  • secret_options (Union[IResolvable, Sequence[Union[SecretProperty, Dict[str, Any], IResolvable]], None]) –

    The secrets to pass to the log configuration. For more information, see Specifying sensitive data in the Amazon Elastic Container Service Developer Guide .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

log_configuration_property = ecs.CfnTaskDefinition.LogConfigurationProperty(
    log_driver="logDriver",

    # the properties below are optional
    options={
        "options_key": "options"
    },
    secret_options=[ecs.CfnTaskDefinition.SecretProperty(
        name="name",
        value_from="valueFrom"
    )]
)

Attributes

log_driver

The log driver to use for the container.

For tasks on AWS Fargate , the supported log drivers are awslogs , splunk , and awsfirelens .

For tasks hosted on Amazon EC2 instances, the supported log drivers are awslogs , fluentd , gelf , json-file , journald , logentries , syslog , splunk , and awsfirelens .

For more information about using the awslogs log driver, see Using the awslogs log driver in the Amazon Elastic Container Service Developer Guide .

For more information about using the awsfirelens log driver, see Custom log routing in the Amazon Elastic Container Service Developer Guide . .. epigraph:

If you have a custom driver that isn't listed, you can fork the Amazon ECS container agent project that's `available on GitHub <https://docs.aws.amazon.com/https://github.com/aws/amazon-ecs-agent>`_ and customize it to work with that driver. We encourage you to submit pull requests for changes that you would like to have included. However, we don't currently provide support for running modified copies of this software.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration-logdriver

Return type

str

options

The configuration options to send to the log driver.

This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration-options

Return type

Union[IResolvable, Mapping[str, str], None]

secret_options

The secrets to pass to the log configuration.

For more information, see Specifying sensitive data in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html#cfn-ecs-taskdefinition-logconfiguration-secretoptions

Return type

Union[IResolvable, List[Union[SecretProperty, IResolvable]], None]

MountPointProperty

class CfnTaskDefinition.MountPointProperty(*, container_path=None, read_only=None, source_volume=None)

Bases: object

The MountPoint property specifies details on a volume mount point that is used in a container definition.

Parameters
  • container_path (Optional[str]) – The path on the container to mount the host volume at.

  • read_only (Union[bool, IResolvable, None]) – If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

  • source_volume (Optional[str]) – The name of the volume to mount. Must be a volume name referenced in the name parameter of task definition volume .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

mount_point_property = ecs.CfnTaskDefinition.MountPointProperty(
    container_path="containerPath",
    read_only=False,
    source_volume="sourceVolume"
)

Attributes

container_path

The path on the container to mount the host volume at.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-containerpath

Return type

Optional[str]

read_only

If this value is true , the container has read-only access to the volume.

If this value is false , then the container can write to the volume. The default value is false .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-readonly

Return type

Union[bool, IResolvable, None]

source_volume

The name of the volume to mount.

Must be a volume name referenced in the name parameter of task definition volume .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-sourcevolume

Return type

Optional[str]

PortMappingProperty

class CfnTaskDefinition.PortMappingProperty(*, container_port=None, host_port=None, protocol=None)

Bases: object

The PortMapping property specifies a port mapping.

Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.

If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort . The hostPort can be left blank or it must be the same value as the containerPort .

After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.

Parameters
  • container_port (Union[int, float, None]) – The port number on the container that’s bound to the user-specified or automatically assigned host port. If you use containers in a task with the awsvpc or host network mode, specify the exposed ports using containerPort . If you use containers in a task with the bridge network mode and you specify a container port and not a host port, your container automatically receives a host port in the ephemeral port range. For more information, see hostPort . Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance.

  • host_port (Union[int, float, None]) – The port number on the container instance to reserve for your container. If you are using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort . If you are using containers in a task with the bridge network mode, you can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container automatically receives a port in the ephemeral port range for your container instance operating system and Docker version. The default ephemeral port range for Docker version 1.6.0 and later is listed on the instance under /proc/sys/net/ipv4/ip_local_port_range . If this kernel parameter is unavailable, the default ephemeral port range from 49153 through 65535 is used. Do not attempt to specify a host port in the ephemeral port range as these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range. .. epigraph:: The default ephemeral port range from 49153 through 65535 is always used for Docker versions before 1.6.0. The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS container agent ports 51678-51680. Any host port that was previously specified in a running task is also reserved while the task is running (after a task stops, the host port is released). The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output. A container instance can have up to 100 reserved ports at a time, including the default reserved ports. Automatically assigned ports don’t count toward the 100 reserved ports limit.

  • protocol (Optional[str]) – The protocol used for the port mapping. Valid values are tcp and udp . The default is tcp .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

port_mapping_property = ecs.CfnTaskDefinition.PortMappingProperty(
    container_port=123,
    host_port=123,
    protocol="protocol"
)

Attributes

container_port

The port number on the container that’s bound to the user-specified or automatically assigned host port.

If you use containers in a task with the awsvpc or host network mode, specify the exposed ports using containerPort .

If you use containers in a task with the bridge network mode and you specify a container port and not a host port, your container automatically receives a host port in the ephemeral port range. For more information, see hostPort . Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-containerport

Return type

Union[int, float, None]

host_port

The port number on the container instance to reserve for your container.

If you are using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort .

If you are using containers in a task with the bridge network mode, you can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container automatically receives a port in the ephemeral port range for your container instance operating system and Docker version.

The default ephemeral port range for Docker version 1.6.0 and later is listed on the instance under /proc/sys/net/ipv4/ip_local_port_range . If this kernel parameter is unavailable, the default ephemeral port range from 49153 through 65535 is used. Do not attempt to specify a host port in the ephemeral port range as these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range. .. epigraph:

The default ephemeral port range from 49153 through 65535 is always used for Docker versions before 1.6.0.

The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS container agent ports 51678-51680. Any host port that was previously specified in a running task is also reserved while the task is running (after a task stops, the host port is released). The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output. A container instance can have up to 100 reserved ports at a time, including the default reserved ports. Automatically assigned ports don’t count toward the 100 reserved ports limit.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-readonly

Return type

Union[int, float, None]

protocol

The protocol used for the port mapping.

Valid values are tcp and udp . The default is tcp .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-sourcevolume

Return type

Optional[str]

ProxyConfigurationProperty

class CfnTaskDefinition.ProxyConfigurationProperty(*, container_name, proxy_configuration_properties=None, type=None)

Bases: object

The ProxyConfiguration property specifies the details for the App Mesh proxy.

For tasks using the EC2 launch type, the container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of the ecs-init package to enable a proxy configuration. If your container instances are launched from the Amazon ECS-optimized AMI version 20190301 or later, then they contain the required versions of the container agent and ecs-init . For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide .

For tasks using the Fargate launch type, the task or service requires platform version 1.3.0 or later.

Parameters
  • container_name (str) – The name of the container that will serve as the App Mesh proxy.

  • proxy_configuration_properties (Union[IResolvable, Sequence[Union[IResolvable, KeyValuePairProperty, Dict[str, Any]]], None]) – The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, specified as key-value pairs. - IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the user parameter in a container definition. This is used to ensure the proxy ignores its own traffic. If IgnoredGID is specified, this field can be empty. - IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the user parameter in a container definition. This is used to ensure the proxy ignores its own traffic. If IgnoredUID is specified, this field can be empty. - AppPorts - (Required) The list of ports that the application uses. Network traffic to these ports is forwarded to the ProxyIngressPort and ProxyEgressPort . - ProxyIngressPort - (Required) Specifies the port that incoming traffic to the AppPorts is directed to. - ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the AppPorts is directed to. - EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and not redirected to the ProxyEgressPort . It can be an empty list. - EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored and not redirected to the ProxyEgressPort . It can be an empty list.

  • type (Optional[str]) – The proxy type. The only supported value is APPMESH .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

proxy_configuration_property = ecs.CfnTaskDefinition.ProxyConfigurationProperty(
    container_name="containerName",

    # the properties below are optional
    proxy_configuration_properties=[ecs.CfnTaskDefinition.KeyValuePairProperty(
        name="name",
        value="value"
    )],
    type="type"
)

Attributes

container_name

The name of the container that will serve as the App Mesh proxy.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-proxyconfiguration.html#cfn-ecs-taskdefinition-proxyconfiguration-containername

Return type

str

proxy_configuration_properties

The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, specified as key-value pairs.

  • IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the user parameter in a container definition. This is used to ensure the proxy ignores its own traffic. If IgnoredGID is specified, this field can be empty.

  • IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the user parameter in a container definition. This is used to ensure the proxy ignores its own traffic. If IgnoredUID is specified, this field can be empty.

  • AppPorts - (Required) The list of ports that the application uses. Network traffic to these ports is forwarded to the ProxyIngressPort and ProxyEgressPort .

  • ProxyIngressPort - (Required) Specifies the port that incoming traffic to the AppPorts is directed to.

  • ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the AppPorts is directed to.

  • EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and not redirected to the ProxyEgressPort . It can be an empty list.

  • EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored and not redirected to the ProxyEgressPort . It can be an empty list.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-proxyconfiguration.html#cfn-ecs-taskdefinition-proxyconfiguration-proxyconfigurationproperties

Return type

Union[IResolvable, List[Union[IResolvable, KeyValuePairProperty]], None]

type

The proxy type.

The only supported value is APPMESH .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-proxyconfiguration.html#cfn-ecs-taskdefinition-proxyconfiguration-type

Return type

Optional[str]

RepositoryCredentialsProperty

class CfnTaskDefinition.RepositoryCredentialsProperty(*, credentials_parameter=None)

Bases: object

The RepositoryCredentials property specifies the repository credentials for private registry authentication.

Parameters

credentials_parameter (Optional[str]) – The Amazon Resource Name (ARN) of the secret containing the private repository credentials. .. epigraph:: When you use the Amazon ECS API, AWS CLI , or AWS SDK, if the secret exists in the same Region as the task that you’re launching then you can use either the full ARN or the name of the secret. When you use the AWS Management Console, you must specify the full ARN of the secret.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

repository_credentials_property = ecs.CfnTaskDefinition.RepositoryCredentialsProperty(
    credentials_parameter="credentialsParameter"
)

Attributes

credentials_parameter

The Amazon Resource Name (ARN) of the secret containing the private repository credentials.

When you use the Amazon ECS API, AWS CLI , or AWS SDK, if the secret exists in the same Region as the task that you’re launching then you can use either the full ARN or the name of the secret. When you use the AWS Management Console, you must specify the full ARN of the secret.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-repositorycredentials.html#cfn-ecs-taskdefinition-repositorycredentials-credentialsparameter

Return type

Optional[str]

ResourceRequirementProperty

class CfnTaskDefinition.ResourceRequirementProperty(*, type, value)

Bases: object

The ResourceRequirement property specifies the type and amount of a resource to assign to a container.

The only supported resource is a GPU. For more information, see Working with GPUs on Amazon ECS in the Amazon Elastic Container Service Developer Guide

Parameters
  • type (str) – The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator .

  • value (str) – The value for the specified resource type. If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on. If the InferenceAccelerator type is used, the value should match the DeviceName for an InferenceAccelerator specified in a task definition.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

resource_requirement_property = ecs.CfnTaskDefinition.ResourceRequirementProperty(
    type="type",
    value="value"
)

Attributes

type

The type of resource to assign to a container.

The supported values are GPU or InferenceAccelerator .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-resourcerequirement.html#cfn-ecs-taskdefinition-resourcerequirement-type

Return type

str

value

The value for the specified resource type.

If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.

If the InferenceAccelerator type is used, the value should match the DeviceName for an InferenceAccelerator specified in a task definition.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-resourcerequirement.html#cfn-ecs-taskdefinition-resourcerequirement-value

Return type

str

RuntimePlatformProperty

class CfnTaskDefinition.RuntimePlatformProperty(*, cpu_architecture=None, operating_system_family=None)

Bases: object

Information about the platform for the Amazon ECS service or task.

For more informataion about RuntimePlatform , see RuntimePlatform in the Amazon Elastic Container Service Developer Guide .

Parameters
  • cpu_architecture (Optional[str]) – The CPU architecture. You can run your Linux tasks on an ARM-based platform by setting the value to ARM64 . This option is avaiable for tasks that run on Linux Amazon EC2 instance or Linux containers on Fargate.

  • operating_system_family (Optional[str]) – The operating system.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

runtime_platform_property = ecs.CfnTaskDefinition.RuntimePlatformProperty(
    cpu_architecture="cpuArchitecture",
    operating_system_family="operatingSystemFamily"
)

Attributes

cpu_architecture

The CPU architecture.

You can run your Linux tasks on an ARM-based platform by setting the value to ARM64 . This option is avaiable for tasks that run on Linux Amazon EC2 instance or Linux containers on Fargate.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-cpuarchitecture

Return type

Optional[str]

operating_system_family

The operating system.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-operatingsystemfamily

Return type

Optional[str]

SecretProperty

class CfnTaskDefinition.SecretProperty(*, name, value_from)

Bases: object

The Secret property specifies an object representing the secret to expose to your container.

For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide .

Parameters
  • name (str) – The name of the secret.

  • value_from (str) –

    The secret to expose to the container. The supported values are either the full ARN of the AWS Secrets Manager secret or the full ARN of the parameter in the SSM Parameter Store. For information about the require AWS Identity and Access Management permissions, see Required IAM permissions for Amazon ECS secrets (for Secrets Manager) or Required IAM permissions for Amazon ECS secrets (for Systems Manager Parameter store) in the Amazon Elastic Container Service Developer Guide . .. epigraph:: If the SSM Parameter Store parameter exists in the same Region as the task you’re launching, then you can use either the full ARN or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

secret_property = ecs.CfnTaskDefinition.SecretProperty(
    name="name",
    value_from="valueFrom"
)

Attributes

name

The name of the secret.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-secret.html#cfn-ecs-taskdefinition-secret-name

Return type

str

value_from

The secret to expose to the container.

The supported values are either the full ARN of the AWS Secrets Manager secret or the full ARN of the parameter in the SSM Parameter Store.

For information about the require AWS Identity and Access Management permissions, see Required IAM permissions for Amazon ECS secrets (for Secrets Manager) or Required IAM permissions for Amazon ECS secrets (for Systems Manager Parameter store) in the Amazon Elastic Container Service Developer Guide . .. epigraph:

If the SSM Parameter Store parameter exists in the same Region as the task you're launching, then you can use either the full ARN or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-secret.html#cfn-ecs-taskdefinition-secret-valuefrom

Return type

str

SystemControlProperty

class CfnTaskDefinition.SystemControlProperty(*, namespace=None, value=None)

Bases: object

A list of namespaced kernel parameters to set in the container.

This parameter maps to Sysctls in the Create a container section of the Docker Remote API and the --sysctl option to docker run .

We don’t recommend that you specify network-related systemControls parameters for multiple containers in a single task. This task also uses either the awsvpc or host network mode. It does it for the following reasons.

  • For tasks that use the awsvpc network mode, if you set systemControls for any container, it applies to all containers in the task. If you set different systemControls for multiple containers in a single task, the container that’s started last determines which systemControls take effect.

  • For tasks that use the host network mode, the systemControls parameter applies to the container instance’s kernel parameter and that of all containers of any tasks running on that container instance.

Parameters
  • namespace (Optional[str]) – The namespaced kernel parameter to set a value for.

  • value (Optional[str]) – The value for the namespaced kernel parameter that’s specified in namespace .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

system_control_property = ecs.CfnTaskDefinition.SystemControlProperty(
    namespace="namespace",
    value="value"
)

Attributes

namespace

The namespaced kernel parameter to set a value for.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-systemcontrol.html#cfn-ecs-taskdefinition-systemcontrol-namespace

Return type

Optional[str]

value

The value for the namespaced kernel parameter that’s specified in namespace .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-systemcontrol.html#cfn-ecs-taskdefinition-systemcontrol-value

Return type

Optional[str]

TaskDefinitionPlacementConstraintProperty

class CfnTaskDefinition.TaskDefinitionPlacementConstraintProperty(*, type, expression=None)

Bases: object

The TaskDefinitionPlacementConstraint property specifies an object representing a constraint on task placement in the task definition.

If you are using the Fargate launch type, task placement constraints are not supported.

For more information, see Task Placement Constraints in the Amazon Elastic Container Service Developer Guide .

Parameters
  • type (str) – The type of constraint. The MemberOf constraint restricts selection to be from a group of valid candidates.

  • expression (Optional[str]) – A cluster query language expression to apply to the constraint. For more information, see Cluster query language in the Amazon Elastic Container Service Developer Guide .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

task_definition_placement_constraint_property = ecs.CfnTaskDefinition.TaskDefinitionPlacementConstraintProperty(
    type="type",

    # the properties below are optional
    expression="expression"
)

Attributes

expression

A cluster query language expression to apply to the constraint.

For more information, see Cluster query language in the Amazon Elastic Container Service Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-taskdefinitionplacementconstraint.html#cfn-ecs-taskdefinition-taskdefinitionplacementconstraint-expression

Return type

Optional[str]

type

The type of constraint.

The MemberOf constraint restricts selection to be from a group of valid candidates.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-taskdefinitionplacementconstraint.html#cfn-ecs-taskdefinition-taskdefinitionplacementconstraint-type

Return type

str

TmpfsProperty

class CfnTaskDefinition.TmpfsProperty(*, size, container_path=None, mount_options=None)

Bases: object

The Tmpfs property specifies the container path, mount options, and size of the tmpfs mount.

Parameters
  • size (Union[int, float]) – The maximum size (in MiB) of the tmpfs volume.

  • container_path (Optional[str]) – The absolute file path where the tmpfs volume is to be mounted.

  • mount_options (Optional[Sequence[str]]) – The list of tmpfs volume mount options. Valid values: "defaults" | "ro" | "rw" | "suid" | "nosuid" | "dev" | "nodev" | "exec" | "noexec" | "sync" | "async" | "dirsync" | "remount" | "mand" | "nomand" | "atime" | "noatime" | "diratime" | "nodiratime" | "bind" | "rbind" | "unbindable" | "runbindable" | "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave" | "relatime" | "norelatime" | "strictatime" | "nostrictatime" | "mode" | "uid" | "gid" | "nr_inodes" | "nr_blocks" | "mpol"

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

tmpfs_property = ecs.CfnTaskDefinition.TmpfsProperty(
    size=123,

    # the properties below are optional
    container_path="containerPath",
    mount_options=["mountOptions"]
)

Attributes

container_path

The absolute file path where the tmpfs volume is to be mounted.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-tmpfs.html#cfn-ecs-taskdefinition-tmpfs-containerpath

Return type

Optional[str]

mount_options

The list of tmpfs volume mount options.

Valid values: "defaults" | "ro" | "rw" | "suid" | "nosuid" | "dev" | "nodev" | "exec" | "noexec" | "sync" | "async" | "dirsync" | "remount" | "mand" | "nomand" | "atime" | "noatime" | "diratime" | "nodiratime" | "bind" | "rbind" | "unbindable" | "runbindable" | "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave" | "relatime" | "norelatime" | "strictatime" | "nostrictatime" | "mode" | "uid" | "gid" | "nr_inodes" | "nr_blocks" | "mpol"

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-tmpfs.html#cfn-ecs-taskdefinition-tmpfs-mountoptions

Return type

Optional[List[str]]

size

The maximum size (in MiB) of the tmpfs volume.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-tmpfs.html#cfn-ecs-taskdefinition-tmpfs-size

Return type

Union[int, float]

UlimitProperty

class CfnTaskDefinition.UlimitProperty(*, hard_limit, name, soft_limit)

Bases: object

The Ulimit property specifies the ulimit settings to pass to the container.

Parameters
  • hard_limit (Union[int, float]) – The hard limit for the ulimit type.

  • name (str) – The type of the ulimit .

  • soft_limit (Union[int, float]) – The soft limit for the ulimit type.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

ulimit_property = ecs.CfnTaskDefinition.UlimitProperty(
    hard_limit=123,
    name="name",
    soft_limit=123
)

Attributes

hard_limit

The hard limit for the ulimit type.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-hardlimit

Return type

Union[int, float]

name

The type of the ulimit .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-name

Return type

str

soft_limit

The soft limit for the ulimit type.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-softlimit

Return type

Union[int, float]

VolumeFromProperty

class CfnTaskDefinition.VolumeFromProperty(*, read_only=None, source_container=None)

Bases: object

The VolumeFrom property specifies details on a data volume from another container in the same task definition.

Parameters
  • read_only (Union[bool, IResolvable, None]) – If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

  • source_container (Optional[str]) – The name of another container within the same task definition to mount volumes from.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

volume_from_property = ecs.CfnTaskDefinition.VolumeFromProperty(
    read_only=False,
    source_container="sourceContainer"
)

Attributes

read_only

If this value is true , the container has read-only access to the volume.

If this value is false , then the container can write to the volume. The default value is false .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-volumesfrom.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom-readonly

Return type

Union[bool, IResolvable, None]

source_container

The name of another container within the same task definition to mount volumes from.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-volumesfrom.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom-sourcecontainer

Return type

Optional[str]

VolumeProperty

class CfnTaskDefinition.VolumeProperty(*, docker_volume_configuration=None, efs_volume_configuration=None, host=None, name=None)

Bases: object

The Volume property specifies a data volume used in a task definition.

For tasks that use a Docker volume, specify a DockerVolumeConfiguration . For tasks that use a bind mount host volume, specify a host and optional sourcePath . For more information, see Using Data Volumes in Tasks .

Parameters
  • docker_volume_configuration (Union[IResolvable, DockerVolumeConfigurationProperty, Dict[str, Any], None]) – This parameter is specified when you use Docker volumes. Windows containers only support the use of the local driver. To use bind mounts, specify the host parameter instead. .. epigraph:: Docker volumes aren’t supported by tasks run on AWS Fargate .

  • efs_volume_configuration (Union[IResolvable, EFSVolumeConfigurationProperty, Dict[str, Any], None]) – This parameter is specified when you use an Amazon Elastic File System file system for task storage.

  • host (Union[IResolvable, HostVolumePropertiesProperty, Dict[str, Any], None]) – This parameter is specified when you use bind mount host volumes. The contents of the host parameter determine whether your bind mount host volume persists on the host container instance and where it’s stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn’t guaranteed to persist after the containers that are associated with it stop running. Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can’t mount directories on a different drive, and mount point can’t be across drives. For example, you can mount C:\my\path:C:\my\path and D:\:D:\ , but not D:\my\path:C:\my\path or D:\:C:\my\path .

  • name (Optional[str]) – The name of the volume. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

volume_property = ecs.CfnTaskDefinition.VolumeProperty(
    docker_volume_configuration=ecs.CfnTaskDefinition.DockerVolumeConfigurationProperty(
        autoprovision=False,
        driver="driver",
        driver_opts={
            "driver_opts_key": "driverOpts"
        },
        labels={
            "labels_key": "labels"
        },
        scope="scope"
    ),
    efs_volume_configuration=ecs.CfnTaskDefinition.EFSVolumeConfigurationProperty(
        filesystem_id="filesystemId",

        # the properties below are optional
        authorization_config=ecs.CfnTaskDefinition.AuthorizationConfigProperty(
            access_point_id="accessPointId",
            iam="iam"
        ),
        root_directory="rootDirectory",
        transit_encryption="transitEncryption",
        transit_encryption_port=123
    ),
    host=ecs.CfnTaskDefinition.HostVolumePropertiesProperty(
        source_path="sourcePath"
    ),
    name="name"
)

Attributes

docker_volume_configuration

This parameter is specified when you use Docker volumes.

Windows containers only support the use of the local driver. To use bind mounts, specify the host parameter instead. .. epigraph:

Docker volumes aren't supported by tasks run on AWS Fargate .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volume-dockervolumeconfiguration

Return type

Union[IResolvable, DockerVolumeConfigurationProperty, None]

efs_volume_configuration

This parameter is specified when you use an Amazon Elastic File System file system for task storage.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volume-efsvolumeconfiguration

Return type

Union[IResolvable, EFSVolumeConfigurationProperty, None]

host

This parameter is specified when you use bind mount host volumes.

The contents of the host parameter determine whether your bind mount host volume persists on the host container instance and where it’s stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn’t guaranteed to persist after the containers that are associated with it stop running.

Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can’t mount directories on a different drive, and mount point can’t be across drives. For example, you can mount C:\my\path:C:\my\path and D:\:D:\ , but not D:\my\path:C:\my\path or D:\:C:\my\path .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volumes-host

Return type

Union[IResolvable, HostVolumePropertiesProperty, None]

name

The name of the volume.

Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volumes-name

Return type

Optional[str]