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: CfnResource

Registers a new task definition from the supplied family and containerDefinitions .

Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide .

You can specify a role for your task with the taskRoleArn parameter. When you specify a role for a task, its containers can then use the latest versions of the AWS CLI or SDKs to make API requests to the AWS services that are specified in the policy that’s associated with the role. For more information, see IAM Roles for Tasks in the Amazon Elastic Container Service Developer Guide .

You can specify a Docker networking mode for the containers in your task definition with the networkMode parameter. If you specify the awsvpc network mode, the task is allocated an elastic network interface, and you must specify a NetworkConfiguration 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 .

See:

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

CloudformationResource:

AWS::ECS::TaskDefinition

ExampleMetadata:

fixture=_generated

Example:

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

cfn_task_definition = ecs.CfnTaskDefinition(self, "MyCfnTaskDefinition",
    container_definitions=[ecs.CfnTaskDefinition.ContainerDefinitionProperty(
        image="image",
        name="name",

        # the properties below are optional
        command=["command"],
        cpu=123,
        credential_specs=["credentialSpecs"],
        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",
        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"
        )],
        port_mappings=[ecs.CfnTaskDefinition.PortMappingProperty(
            app_protocol="appProtocol",
            container_port=123,
            container_port_range="containerPortRange",
            host_port=123,
            name="name",
            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"
        )],
        restart_policy=ecs.CfnTaskDefinition.RestartPolicyProperty(
            enabled=False,
            ignored_exit_codes=[123],
            restart_attempt_period=123
        ),
        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",
        version_consistency="versionConsistency",
        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(
        configured_at_launch=False,
        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
        ),
        f_sx_windows_file_server_volume_configuration=ecs.CfnTaskDefinition.FSxWindowsFileServerVolumeConfigurationProperty(
            file_system_id="fileSystemId",
            root_directory="rootDirectory",

            # the properties below are optional
            authorization_config=ecs.CfnTaskDefinition.FSxAuthorizationConfigProperty(
                credentials_parameter="credentialsParameter",
                domain="domain"
            )
        ),
        host=ecs.CfnTaskDefinition.HostVolumePropertiesProperty(
            source_path="sourcePath"
        ),
        name="name"
    )]
)
Parameters:
  • scope (Construct) – Scope in which this resource is defined.

  • id (str) – Construct identifier for this resource (unique in its scope).

  • container_definitions (Union[IResolvable, Sequence[Union[IResolvable, ContainerDefinitionProperty, Dict[str, Any]]], 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. If you use the EC2 launch type, this field is optional. Supported values are between 128 CPU units ( 0.125 vCPUs) and 10240 CPU units ( 10 vCPUs). 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: 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - 4096 (4 vCPU) - Available memory values: 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - 8192 (8 vCPU) - Available memory values: 16 GB and 60 GB in 4 GB increments This option requires Linux platform 1.4.0 or later. - 16384 (16vCPU) - Available memory values: 32GB and 120 GB in 8 GB increments This option requires Linux platform 1.4.0 or later.

  • 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. For informationabout the required IAM roles for Amazon ECS, see IAM roles for Amazon ECS 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. If the host IPC mode is used, be aware that there is a heightened risk of undesired IPC namespace expose. 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) - Between 16 GB and 60 GB in 4 GB increments - Available cpu values: 8192 (8 vCPU) This option requires Linux platform 1.4.0 or later. - Between 32GB and 120 GB in 8 GB increments - Available cpu values: 16384 (16 vCPU) This option requires Linux platform 1.4.0 or later.

  • 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 . If no network mode is specified, the default is bridge . For Amazon ECS tasks on Fargate, the awsvpc network mode is required. For Amazon ECS tasks on Amazon EC2 Linux instances, any network mode can be used. For Amazon ECS tasks on Amazon EC2 Windows instances, <default> or awsvpc 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. .. epigraph:: When using the host network mode, you should not run containers using the root user (UID 0). It is considered best practice to use a non-root user. 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 . 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.

  • pid_mode (Optional[str]) – The process namespace to use for the containers in the task. The valid values are host or task . On Fargate for Linux containers, the only valid value is task . For example, monitoring sidecars might need pidMode to access information about other containers running in the same task. If host is specified, 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 each container. If the host PID mode is used, there’s a heightened risk of undesired process namespace exposure. .. epigraph:: This parameter is not supported for Windows containers. > This parameter is only supported for tasks that are hosted on AWS Fargate if the tasks are using platform version 1.4.0 or later (Linux). This isn’t supported for Windows containers on 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[IResolvable, ProxyConfigurationProperty, Dict[str, Any], None]) – 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 use a proxy configuration. If your container instances are launched from the Amazon ECS optimized AMI version 20190301 or later, 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. The valid values are EC2 , FARGATE , and EXTERNAL . For more information, see Amazon ECS launch types in the Amazon Elastic Container Service Developer Guide .

  • 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.

  • 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: + - = . _ : /

  • 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 . .. epigraph:: String validation is done on the ECS side. If an invalid string value is given for TaskRoleArn , it may cause the Cloudformation job to hang.

  • 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_dependency(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_depends_on(target)

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

Parameters:

target (CfnResource) –

Deprecated:

use addDependency

Stability:

deprecated

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

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.

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 intermediate 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). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

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 resource, please consult that specific resource’s documentation.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

Return type:

None

get_att(attribute_name, type_hint=None)

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.

  • type_hint (Optional[ResolutionTypeHint]) –

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

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.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) – tree inspector to collect and process attributes.

Return type:

None

obtain_dependencies()

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Return type:

List[Union[Stack, CfnResource]]

obtain_resource_dependencies()

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Return type:

List[CfnResource]

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

remove_dependency(target)

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

replace_dependency(target, new_target)

Replaces one dependency with another.

Parameters:
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

The ARN of the task definition.

CloudformationAttribute:

TaskDefinitionArn

cfn_options

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

cfn_resource_type

AWS resource type.

container_definitions

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

cpu

The number of cpu units used by the task.

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.

ephemeral_storage

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

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.

family

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

inference_accelerators

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

ipc_mode

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

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).

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.

network_mode

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

node

The tree node.

pid_mode

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

placement_constraints

An array of placement constraint objects to use for tasks.

proxy_configuration

The configuration details for the App Mesh proxy.

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 }).

requires_compatibilities

The task launch types the task definition was validated against.

runtime_platform

The operating system that your tasks definitions run on.

stack

The stack in which this element is defined.

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

tags

Tag Manager which manages the tags for this resource.

tags_raw

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

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.

volumes

The list of data volume definitions for the task.

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(x)

Check whether the given object is a CfnResource.

Parameters:

x (Any) –

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

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 on 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 role defined in a task definition when mounting the Amazon EFS file system. If it is turned on, transit encryption must be turned on 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 .

See:

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.
from aws_cdk import 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 on in the EFSVolumeConfiguration . For more information, see Working with Amazon EFS access points in the Amazon Elastic File System User Guide .

See:

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

iam

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

If it is turned on, transit encryption must be turned on 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 .

See:

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

ContainerDefinitionProperty

class CfnTaskDefinition.ContainerDefinitionProperty(*, image, name, command=None, cpu=None, credential_specs=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, interactive=None, links=None, linux_parameters=None, log_configuration=None, memory=None, memory_reservation=None, mount_points=None, port_mappings=None, privileged=None, pseudo_terminal=None, readonly_root_filesystem=None, repository_credentials=None, resource_requirements=None, restart_policy=None, secrets=None, start_timeout=None, stop_timeout=None, system_controls=None, ulimits=None, user=None, version_consistency=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:
  • image (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 docker container create command 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 ).

  • name (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 docker container create command and the --name option to docker run.

  • command (Optional[Sequence[str]]) – The command that’s passed to the container. This parameter maps to Cmd in the docker container create command and the COMMAND parameter to docker run. 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 docker container create commandand 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. The minimum valid CPU share value that the Linux kernel allows is 2, and the maximum valid CPU share value that the Linux kernel allows is 262144. However, the CPU parameter isn’t required, and you can use CPU values below 2 or above 262144 in your container definitions. For CPU values below 2 (including null) or above 262144, 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. - Agent versions greater than or equal to 1.84.0: CPU values greater than 256 vCPU are passed to Docker as 256, which is equivalent to 262144 CPU shares. 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.

  • credential_specs (Optional[Sequence[str]]) – A list of ARNs in SSM or Amazon S3 to a credential spec ( CredSpec ) file that configures the container for Active Directory authentication. We recommend that you use this parameter instead of the dockerSecurityOptions . The maximum number of ARNs is 1. There are two formats for each ARN. - credentialspecdomainless:MyARN - You use credentialspecdomainless:MyARN to provide a CredSpec with an additional section for a secret in AWS Secrets Manager . You provide the login credentials to the domain in the secret. Each task that runs on any container instance can join different domains. You can use this format without joining the container instance to a domain. - credentialspec:MyARN - You use credentialspec:MyARN to provide a CredSpec for a single domain. You must join the container instance to the domain before you start any tasks that use this task definition. In both formats, replace MyARN with the ARN in SSM or Amazon S3. If you provide a credentialspecdomainless:MyARN , the credspec must provide a ARN in AWS Secrets Manager for a secret containing the username, password, and the domain to connect to. For better security, the instance isn’t joined to the domain for domainless authentication. Other applications on the instance can’t use the domainless credentials. You can use this parameter to run tasks on the same instance, even it the tasks need to join different domains. For more information, see Using gMSAs for Windows Containers and Using gMSAs for Linux Containers .

  • 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. If the task definition is used in a blue/green deployment that uses AWS::CodeDeploy::DeploymentGroup BlueGreenDeploymentConfiguration , the dependsOn parameter is not supported. For more information see Issue #680 on the on the GitHub website.

  • disable_networking (Union[bool, IResolvable, None]) – When this parameter is true, networking is off within the container. This parameter maps to NetworkDisabled in the docker container create command. .. 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 docker container create command 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 docker container create command 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 docker container create command 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 configuration for multiple security systems. This field isn’t valid for containers in tasks using the Fargate launch type. For Linux tasks on EC2, this parameter can be used to reference custom labels for SELinux and AppArmor multi-level security systems. For any tasks on EC2, this parameter can be used to reference a credential spec file that configures a container for Active Directory authentication. For more information, see Using gMSAs for Windows Containers and Using gMSAs for Linux Containers in the Amazon Elastic Container Service Developer Guide . This parameter maps to SecurityOpt in the docker container create command 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 . 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 docker container create command and the --entrypoint option to docker run.

  • 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 docker container create command 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. 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 docker container create command 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 docker container create command and the HEALTHCHECK parameter of docker run.

  • hostname (Optional[str]) – The hostname to use for your container. This parameter maps to Hostname in the docker container create command and the --hostname option to docker run. .. epigraph:: The hostname parameter is not supported if you’re using the awsvpc network mode.

  • 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 docker container create command 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.. This parameter maps to Links in the docker container create command 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[IResolvable, LinuxParametersProperty, Dict[str, Any], 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 docker Create a container command 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 docker container create command 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 20.10.0 or later daemon reserves a minimum of 6 MiB of memory for a container. So, don’t specify less 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, don’t specify less 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 docker container create command 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.

  • 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 docker container create command 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 docker container create command 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 docker container create command and the --read-only option to docker run. .. epigraph:: This parameter is not supported for Windows containers.

  • repository_credentials (Union[IResolvable, RepositoryCredentialsProperty, Dict[str, Any], 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.

  • restart_policy (Union[IResolvable, RestartPolicyProperty, Dict[str, Any], None]) – The restart policy for a container. When you set up a restart policy, Amazon ECS can restart the container without needing to replace the task. For more information, see Restart individual containers in Amazon ECS tasks with container restart policies in the Amazon Elastic Container Service Developer Guide .

  • secrets (Union[IResolvable, Sequence[Union[IResolvable, SecretProperty, Dict[str, Any]]], 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 . The valid values for Fargate are 2-120 seconds.

  • 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. For tasks that use the Fargate launch type, 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 . The valid values for Fargate are 2-120 seconds.

  • 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 docker container create command and the --sysctl option to docker run. For example, you can configure net.ipv4.tcp_keepalive_time setting to maintain longer lived connections.

  • 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 docker container create command 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.

  • version_consistency (Optional[str]) – Specifies whether Amazon ECS will resolve the container image tag provided in the container definition to an image digest. By default, the value is enabled . If you set the value for a container as disabled , Amazon ECS will not resolve the provided container image tag to a digest and will use the original image URI specified in the container definition for deployment. For more information about container image resolution, see Container image resolution in the Amazon ECS Developer Guide . Default: - “enabled”

  • 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 docker container create command 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 docker container create command and the --workdir option to docker run.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

container_definition_property = ecs.CfnTaskDefinition.ContainerDefinitionProperty(
    image="image",
    name="name",

    # the properties below are optional
    command=["command"],
    cpu=123,
    credential_specs=["credentialSpecs"],
    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",
    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"
    )],
    port_mappings=[ecs.CfnTaskDefinition.PortMappingProperty(
        app_protocol="appProtocol",
        container_port=123,
        container_port_range="containerPortRange",
        host_port=123,
        name="name",
        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"
    )],
    restart_policy=ecs.CfnTaskDefinition.RestartPolicyProperty(
        enabled=False,
        ignored_exit_codes=[123],
        restart_attempt_period=123
    ),
    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",
    version_consistency="versionConsistency",
    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 docker container create command and the COMMAND parameter to docker run. If there are multiple arguments, each argument is a separated string in the array.

See:

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

cpu

The number of cpu units reserved for the container.

This parameter maps to CpuShares in the docker container create commandand 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. The minimum valid CPU share value that the Linux kernel allows is 2, and the maximum valid CPU share value that the Linux kernel allows is 262144. However, the CPU parameter isn’t required, and you can use CPU values below 2 or above 262144 in your container definitions. For CPU values below 2 (including null) or above 262144, 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.

  • Agent versions greater than or equal to 1.84.0: CPU values greater than 256 vCPU are passed to Docker as 256, which is equivalent to 262144 CPU shares.

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.

See:

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

credential_specs

A list of ARNs in SSM or Amazon S3 to a credential spec ( CredSpec ) file that configures the container for Active Directory authentication.

We recommend that you use this parameter instead of the dockerSecurityOptions . The maximum number of ARNs is 1.

There are two formats for each ARN.

  • credentialspecdomainless:MyARN - You use credentialspecdomainless:MyARN to provide a CredSpec with an additional section for a secret in AWS Secrets Manager . You provide the login credentials to the domain in the secret.

Each task that runs on any container instance can join different domains.

You can use this format without joining the container instance to a domain.

  • credentialspec:MyARN - You use credentialspec:MyARN to provide a CredSpec for a single domain.

You must join the container instance to the domain before you start any tasks that use this task definition.

In both formats, replace MyARN with the ARN in SSM or Amazon S3.

If you provide a credentialspecdomainless:MyARN , the credspec must provide a ARN in AWS Secrets Manager for a secret containing the username, password, and the domain to connect to. For better security, the instance isn’t joined to the domain for domainless authentication. Other applications on the instance can’t use the domainless credentials. You can use this parameter to run tasks on the same instance, even it the tasks need to join different domains. For more information, see Using gMSAs for Windows Containers and Using gMSAs for Linux Containers .

See:

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

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.

If the task definition is used in a blue/green deployment that uses AWS::CodeDeploy::DeploymentGroup BlueGreenDeploymentConfiguration , the dependsOn parameter is not supported. For more information see Issue #680 on the on the GitHub website.

See:

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

disable_networking

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

This parameter maps to NetworkDisabled in the docker container create command. .. epigraph:

This parameter is not supported for Windows containers.
See:

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

dns_search_domains

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

This parameter maps to DnsSearch in the docker container create command and the --dns-search option to docker run. .. epigraph:

This parameter is not supported for Windows containers.
See:

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

dns_servers

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

This parameter maps to Dns in the docker container create command and the --dns option to docker run. .. epigraph:

This parameter is not supported for Windows containers.
See:

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

docker_labels

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

This parameter maps to Labels in the docker container create command 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}}'

See:

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

docker_security_options

A list of strings to provide custom configuration for multiple security systems.

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

For Linux tasks on EC2, this parameter can be used to reference custom labels for SELinux and AppArmor multi-level security systems.

For any tasks on EC2, this parameter can be used to reference a credential spec file that configures a container for Active Directory authentication. For more information, see Using gMSAs for Windows Containers and Using gMSAs for Linux Containers in the Amazon Elastic Container Service Developer Guide .

This parameter maps to SecurityOpt in the docker container create command 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* .

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

See:

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

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 docker container create command and the --entrypoint option to docker run.

see:

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

environment

The environment variables to pass to a container.

This parameter maps to Env in the docker container create command 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.
See:

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

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.

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 .

See:

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

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 .

See:

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

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 docker container create command 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.
See:

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

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 .

See:

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

health_check

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

This parameter maps to HealthCheck in the docker container create command and the HEALTHCHECK parameter of docker run.

See:

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

hostname

The hostname to use for your container.

This parameter maps to Hostname in the docker container create command and the --hostname option to docker run. .. epigraph:

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

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

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 docker container create command 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 ).

See:

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

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 docker container create command and the --interactive option to docker run.

See:

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

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.. This parameter maps to Links in the docker container create command 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.
See:

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

linux_parameters

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

This parameter is not supported for Windows containers.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinition.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

log_configuration

The log configuration specification for the container.

This parameter maps to LogConfig in the docker Create a container command 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* .
See:

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

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.

See:

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

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 docker container create command 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 20.10.0 or later daemon reserves a minimum of 6 MiB of memory for a container. So, don’t specify less 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, don’t specify less than 4 MiB of memory for your containers.

See:

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

mount_points

The mount points for data volumes in your container.

This parameter maps to Volumes in the docker container create command 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.

See:

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

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 docker container create command and the --name option to docker run.

See:

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

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.
See:

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

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 docker container create command and the --privileged option to docker run .. epigraph:

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

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

pseudo_terminal

When this parameter is true , a TTY is allocated.

This parameter maps to Tty in the docker container create command and the --tty option to docker run.

See:

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

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 docker container create command and the --read-only option to docker run. .. epigraph:

This parameter is not supported for Windows containers.
See:

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

repository_credentials

The private repository authentication credentials to use.

See:

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

resource_requirements

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

The only supported resource is a GPU.

See:

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

restart_policy

The restart policy for a container.

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

See:

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

secrets

The secrets to pass to the container.

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

See:

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

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 .

The valid values for Fargate are 2-120 seconds.

See:

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

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.

For tasks that use the Fargate launch type, 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 .

The valid values for Fargate are 2-120 seconds.

See:

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

system_controls

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

This parameter maps to Sysctls in the docker container create command and the --sysctl option to docker run. For example, you can configure net.ipv4.tcp_keepalive_time setting to maintain longer lived connections.

See:

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

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.
See:

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

user

The user to use inside the container.

This parameter maps to User in the docker container create command 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.

See:

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

version_consistency

Specifies whether Amazon ECS will resolve the container image tag provided in the container definition to an image digest.

By default, the value is enabled . If you set the value for a container as disabled , Amazon ECS will not resolve the provided container image tag to a digest and will use the original image URI specified in the container definition for deployment. For more information about container image resolution, see Container image resolution in the Amazon ECS Developer Guide .

Default:
  • “enabled”

See:

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

volumes_from

Data volumes to mount from another container.

This parameter maps to VolumesFrom in the docker container create command and the --volumes-from option to docker run.

See:

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

working_directory

The working directory to run commands inside the container in.

This parameter maps to WorkingDir in the docker container create command and the --workdir option to docker run.

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

container_name

The name of a container.

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

host_path

The path for the device on the host container instance.

See:

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

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.

See:

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

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. This parameter maps to Driver in the docker container create command 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 docker create-volume command 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 docker container create command 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.

See:

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.
from aws_cdk import 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 .

See:

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

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. This parameter maps to Driver in the docker container create command and the xxdriver option to docker volume create.

See:

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

driver_opts

A map of Docker driver-specific options passed through.

This parameter maps to DriverOpts in the docker create-volume command and the xxopt option to docker volume create.

See:

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

labels

Custom metadata to add to your Docker volume.

This parameter maps to Labels in the docker container create command and the xxlabel option to docker volume create.

See:

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

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.

See:

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

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 turned on 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 .

See:

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.
from aws_cdk import 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.

See:

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

filesystem_id

The Amazon EFS file system ID to use.

See:

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

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.
See:

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

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 turned on 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 .

See:

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

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 .

See:

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

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.

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 Use a file to pass environment variables to a container in the Amazon Elastic Container Service Developer Guide .

Environment variable files are objects in Amazon S3 and all Amazon S3 security considerations apply.

You must use the following platforms for the Fargate launch type:

  • Linux platform version 1.4.0 or later.

  • Windows platform version 1.0.0 or later.

Consider the following when using the Fargate launch type:

  • The file is handled like a native Docker env-file.

  • There is no support for shell escape handling.

  • The container entry point interperts the VARIABLE values.

Parameters:
  • type (Optional[str]) – The file type to use. Environment files are objects in Amazon S3. The only supported value is s3 .

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

See:

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.
from aws_cdk import aws_ecs as ecs

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

Attributes

type

The file type to use.

Environment files are objects in Amazon S3. The only supported value is s3 .

See:

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

value

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

See:

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

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 Using data volumes in tasks in the Amazon ECS Developer Guide; . .. epigraph:

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

- Linux platform version ``1.4.0`` or later.
- Windows platform version ``1.0.0`` or later.
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.

See:

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.
from aws_cdk import 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.

See:

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

FSxAuthorizationConfigProperty

class CfnTaskDefinition.FSxAuthorizationConfigProperty(*, credentials_parameter, domain)

Bases: object

The authorization configuration details for Amazon FSx for Windows File Server file system.

See FSxWindowsFileServerVolumeConfiguration in the Amazon ECS API Reference .

For more information and the input format, see Amazon FSx for Windows File Server Volumes in the Amazon Elastic Container Service Developer Guide .

Parameters:
  • credentials_parameter (str) – The authorization credential option to use. The authorization credential options can be provided using either the Amazon Resource Name (ARN) of an AWS Secrets Manager secret or SSM Parameter Store parameter. The ARN refers to the stored credentials.

  • domain (str) – A fully qualified domain name hosted by an AWS Directory Service Managed Microsoft AD (Active Directory) or self-hosted AD on Amazon EC2.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

f_sx_authorization_config_property = ecs.CfnTaskDefinition.FSxAuthorizationConfigProperty(
    credentials_parameter="credentialsParameter",
    domain="domain"
)

Attributes

credentials_parameter

The authorization credential option to use.

The authorization credential options can be provided using either the Amazon Resource Name (ARN) of an AWS Secrets Manager secret or SSM Parameter Store parameter. The ARN refers to the stored credentials.

See:

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

domain

//docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html>`_ Managed Microsoft AD (Active Directory) or self-hosted AD on Amazon EC2.

See:

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

Type:

A fully qualified domain name hosted by an `AWS Directory Service <https

FSxWindowsFileServerVolumeConfigurationProperty

class CfnTaskDefinition.FSxWindowsFileServerVolumeConfigurationProperty(*, file_system_id, root_directory, authorization_config=None)

Bases: object

This parameter is specified when you’re using Amazon FSx for Windows File Server file system for task storage.

For more information and the input format, see Amazon FSx for Windows File Server volumes in the Amazon Elastic Container Service Developer Guide .

Parameters:
  • file_system_id (str) – The Amazon FSx for Windows File Server file system ID to use.

  • root_directory (str) – The directory within the Amazon FSx for Windows File Server file system to mount as the root directory inside the host.

  • authorization_config (Union[IResolvable, FSxAuthorizationConfigProperty, Dict[str, Any], None]) – The authorization configuration details for the Amazon FSx for Windows File Server file system.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

f_sx_windows_file_server_volume_configuration_property = ecs.CfnTaskDefinition.FSxWindowsFileServerVolumeConfigurationProperty(
    file_system_id="fileSystemId",
    root_directory="rootDirectory",

    # the properties below are optional
    authorization_config=ecs.CfnTaskDefinition.FSxAuthorizationConfigProperty(
        credentials_parameter="credentialsParameter",
        domain="domain"
    )
)

Attributes

authorization_config

The authorization configuration details for the Amazon FSx for Windows File Server file system.

See:

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

file_system_id

The Amazon FSx for Windows File Server file system ID to use.

See:

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

root_directory

The directory within the Amazon FSx for Windows File Server file system to mount as the root directory inside the host.

See:

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

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 .

See:

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.
from aws_cdk import 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

See:

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

type

The log router to use.

The valid values are fluentd or fluentbit .

See:

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

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). This configuration maps to the HEALTHCHECK parameter of docker run. .. epigraph:

The Amazon ECS container agent only monitors and reports on the health checks specified in the task definition. Amazon ECS does not monitor Docker health checks that are embedded in a container image and not specified in the container definition. Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image.

If a task is run manually, and not as part of a service, the task will continue its lifecycle regardless of its health status. For tasks that are part of a service, if the task reports as unhealthy then the task will be stopped and the service scheduler will replace it.

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 run 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 double quotes and brackets. [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ] You don’t include the double quotes and 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 docker container create command.

  • 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 off. .. 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.

See:

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.
from aws_cdk import 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 run 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 double quotes and brackets.

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

You don’t include the double quotes and 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 docker container create command.

See:

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

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.

See:

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

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.

See:

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

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 off. .. 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.
See:

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

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.

See:

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

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-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.
from aws_cdk import 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.

See:

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

ip_address

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

See:

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

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.

See:

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

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

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.

See:

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.
from aws_cdk import 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 .

See:

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

device_type

The Elastic Inference accelerator type to use.

See:

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

KernelCapabilitiesProperty

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

Bases: object

The Linux capabilities to add or remove from the default Docker configuration for a container defined in the task definition.

For more detailed information about 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 docker container create command 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 docker container create command 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"

See:

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.
from aws_cdk import 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 docker container create command 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"

See:

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

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 docker container create command 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"

See:

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

KeyValuePairProperty

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

Bases: object

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.

See:

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

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

value

The value of the key-value pair.

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

See:

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

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 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 docker container create command 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. If you’re using tasks on Amazon Linux 2023 the swappiness 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. If you’re using tasks on Amazon Linux 2023 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.

See:

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.
from aws_cdk import 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.

See:

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

devices

Any host devices to expose to the container.

This parameter maps to Devices in the docker container create command 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.
See:

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

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}}'

See:

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

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.

If you're using tasks on Amazon Linux 2023 the ``swappiness`` parameter isn't supported.
See:

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

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.
See:

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

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.

If you're using tasks on Amazon Linux 2023 the ``swappiness`` parameter isn't supported.
See:

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

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.
See:

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

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 , syslog , splunk , and awsfirelens . For more information about using the awslogs log driver, see Send Amazon ECS logs to CloudWatch in the Amazon Elastic Container Service Developer Guide . For more information about using the awsfirelens log driver, see Send Amazon ECS logs to an AWS service or AWS Partner . .. 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. The options you can specify depend on the log driver. Some of the options you can specify when you use the awslogs log driver to route logs to Amazon CloudWatch include the following: - awslogs-create-group - Required: No Specify whether you want the log group to be created automatically. If this option isn’t specified, it defaults to false . .. epigraph:: Your IAM policy must include the logs:CreateLogGroup permission before you attempt to use awslogs-create-group . - awslogs-region - Required: Yes Specify the AWS Region that the awslogs log driver is to send your Docker logs to. You can choose to send all of your logs from clusters in different Regions to a single region in CloudWatch Logs. This is so that they’re all visible in one location. Otherwise, you can separate them by Region for more granularity. Make sure that the specified log group exists in the Region that you specify with this option. - awslogs-group - Required: Yes Make sure to specify a log group that the awslogs log driver sends its log streams to. - awslogs-stream-prefix - Required: Yes, when using the Fargate launch type.Optional for the EC2 launch type, required for the Fargate launch type. Use the awslogs-stream-prefix option to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task that the container belongs to. If you specify a prefix with this option, then the log stream takes the format prefix-name/container-name/ecs-task-id . If you don’t specify a prefix with this option, then the log stream is named after the container ID that’s assigned by the Docker daemon on the container instance. Because it’s difficult to trace logs back to the container that sent them with just the Docker container ID (which is only available on the container instance), we recommend that you specify a prefix with this option. For Amazon ECS services, you can use the service name as the prefix. Doing so, you can trace log streams to the service that the container belongs to, the name of the container that sent them, and the ID of the task that the container belongs to. You must specify a stream-prefix for your logs to have your logs appear in the Log pane when using the Amazon ECS console. - awslogs-datetime-format - Required: No This option defines a multiline start pattern in Python strftime format. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. The matched line is the delimiter between log messages. One example of a use case for using this format is for parsing output such as a stack dump, which might otherwise be logged in multiple entries. The correct pattern allows it to be captured in a single entry. For more information, see awslogs-datetime-format . You cannot configure both the awslogs-datetime-format and awslogs-multiline-pattern options. .. epigraph:: Multiline logging performs regular expression parsing and matching of all log messages. This might have a negative impact on logging performance. - awslogs-multiline-pattern - Required: No This option defines a multiline start pattern that uses a regular expression. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. The matched line is the delimiter between log messages. For more information, see awslogs-multiline-pattern . This option is ignored if awslogs-datetime-format is also configured. You cannot configure both the awslogs-datetime-format and awslogs-multiline-pattern options. .. epigraph:: Multiline logging performs regular expression parsing and matching of all log messages. This might have a negative impact on logging performance. - mode - Required: No Valid values: non-blocking | blocking This option defines the delivery mode of log messages from the container to CloudWatch Logs. The delivery mode you choose affects application availability when the flow of logs from container to CloudWatch is interrupted. If you use the blocking mode and the flow of logs to CloudWatch is interrupted, calls from container code to write to the stdout and stderr streams will block. The logging thread of the application will block as a result. This may cause the application to become unresponsive and lead to container healthcheck failure. If you use the non-blocking mode, the container’s logs are instead stored in an in-memory intermediate buffer configured with the max-buffer-size option. This prevents the application from becoming unresponsive when logs cannot be sent to CloudWatch. We recommend using this mode if you want to ensure service availability and are okay with some log loss. For more information, see Preventing log loss with non-blocking mode in the ``awslogs` container log driver <https://docs.aws.amazon.com/containers/preventing-log-loss-with-non-blocking-mode-in-the-awslogs-container-log-driver/>`_ . - max-buffer-size - Required: No Default value: 1m When non-blocking mode is used, the max-buffer-size log option controls the size of the buffer that’s used for intermediate message storage. Make sure to specify an adequate buffer size based on your application. When the buffer fills up, further logs cannot be stored. Logs that cannot be stored are lost. To route logs using the splunk log router, you need to specify a splunk-token and a splunk-url . When you use the awsfirelens log router to route logs to an AWS Service or AWS Partner Network destination for log storage and analytics, you can set the log-driver-buffer-limit option to limit the number of events that are buffered in memory, before being sent to the log router container. It can help to resolve potential log loss issue because high throughput might result in memory running out for the buffer inside of Docker. Other options you can specify when using awsfirelens to route logs depend on the destination. When you export logs to Amazon Data Firehose, you can specify the AWS Region with region and a name for the log stream with delivery_stream . When you export logs to Amazon Kinesis Data Streams, you can specify an AWS Region with region and a data stream name with stream . When you export logs to Amazon OpenSearch Service, you can specify options like Name , Host (OpenSearch Service endpoint without protocol), Port , Index , Type , Aws_auth , Aws_region , Suppress_Type_Name , and tls . When you export logs to Amazon S3, you can specify the bucket using the bucket option. You can also specify region , total_file_size , upload_timeout , and use_put_object as options. 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[IResolvable, SecretProperty, Dict[str, Any]]], None]) –

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-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.
from aws_cdk import 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 , syslog , splunk , and awsfirelens .

For more information about using the awslogs log driver, see Send Amazon ECS logs to CloudWatch in the Amazon Elastic Container Service Developer Guide .

For more information about using the awsfirelens log driver, see Send Amazon ECS logs to an AWS service or AWS Partner . .. 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.
See:

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

options

The configuration options to send to the log driver.

The options you can specify depend on the log driver. Some of the options you can specify when you use the awslogs log driver to route logs to Amazon CloudWatch include the following:

  • awslogs-create-group - Required: No

Specify whether you want the log group to be created automatically. If this option isn’t specified, it defaults to false . .. epigraph:

Your IAM policy must include the ``logs:CreateLogGroup`` permission before you attempt to use ``awslogs-create-group`` .
  • awslogs-region - Required: Yes

Specify the AWS Region that the awslogs log driver is to send your Docker logs to. You can choose to send all of your logs from clusters in different Regions to a single region in CloudWatch Logs. This is so that they’re all visible in one location. Otherwise, you can separate them by Region for more granularity. Make sure that the specified log group exists in the Region that you specify with this option.

  • awslogs-group - Required: Yes

Make sure to specify a log group that the awslogs log driver sends its log streams to.

  • awslogs-stream-prefix - Required: Yes, when using the Fargate launch type.Optional for the EC2 launch type, required for the Fargate launch type.

Use the awslogs-stream-prefix option to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task that the container belongs to. If you specify a prefix with this option, then the log stream takes the format prefix-name/container-name/ecs-task-id .

If you don’t specify a prefix with this option, then the log stream is named after the container ID that’s assigned by the Docker daemon on the container instance. Because it’s difficult to trace logs back to the container that sent them with just the Docker container ID (which is only available on the container instance), we recommend that you specify a prefix with this option.

For Amazon ECS services, you can use the service name as the prefix. Doing so, you can trace log streams to the service that the container belongs to, the name of the container that sent them, and the ID of the task that the container belongs to.

You must specify a stream-prefix for your logs to have your logs appear in the Log pane when using the Amazon ECS console.

  • awslogs-datetime-format - Required: No

This option defines a multiline start pattern in Python strftime format. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. The matched line is the delimiter between log messages.

One example of a use case for using this format is for parsing output such as a stack dump, which might otherwise be logged in multiple entries. The correct pattern allows it to be captured in a single entry.

For more information, see awslogs-datetime-format .

You cannot configure both the awslogs-datetime-format and awslogs-multiline-pattern options. .. epigraph:

Multiline logging performs regular expression parsing and matching of all log messages. This might have a negative impact on logging performance.
  • awslogs-multiline-pattern - Required: No

This option defines a multiline start pattern that uses a regular expression. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. The matched line is the delimiter between log messages.

For more information, see awslogs-multiline-pattern .

This option is ignored if awslogs-datetime-format is also configured.

You cannot configure both the awslogs-datetime-format and awslogs-multiline-pattern options. .. epigraph:

Multiline logging performs regular expression parsing and matching of all log messages. This might have a negative impact on logging performance.
  • mode - Required: No

Valid values: non-blocking | blocking

This option defines the delivery mode of log messages from the container to CloudWatch Logs. The delivery mode you choose affects application availability when the flow of logs from container to CloudWatch is interrupted.

If you use the blocking mode and the flow of logs to CloudWatch is interrupted, calls from container code to write to the stdout and stderr streams will block. The logging thread of the application will block as a result. This may cause the application to become unresponsive and lead to container healthcheck failure.

If you use the non-blocking mode, the container’s logs are instead stored in an in-memory intermediate buffer configured with the max-buffer-size option. This prevents the application from becoming unresponsive when logs cannot be sent to CloudWatch. We recommend using this mode if you want to ensure service availability and are okay with some log loss. For more information, see Preventing log loss with non-blocking mode in the ``awslogs` container log driver <https://docs.aws.amazon.com/containers/preventing-log-loss-with-non-blocking-mode-in-the-awslogs-container-log-driver/>`_ .

  • max-buffer-size - Required: No

Default value: 1m

When non-blocking mode is used, the max-buffer-size log option controls the size of the buffer that’s used for intermediate message storage. Make sure to specify an adequate buffer size based on your application. When the buffer fills up, further logs cannot be stored. Logs that cannot be stored are lost.

To route logs using the splunk log router, you need to specify a splunk-token and a splunk-url .

When you use the awsfirelens log router to route logs to an AWS Service or AWS Partner Network destination for log storage and analytics, you can set the log-driver-buffer-limit option to limit the number of events that are buffered in memory, before being sent to the log router container. It can help to resolve potential log loss issue because high throughput might result in memory running out for the buffer inside of Docker.

Other options you can specify when using awsfirelens to route logs depend on the destination. When you export logs to Amazon Data Firehose, you can specify the AWS Region with region and a name for the log stream with delivery_stream .

When you export logs to Amazon Kinesis Data Streams, you can specify an AWS Region with region and a data stream name with stream .

When you export logs to Amazon OpenSearch Service, you can specify options like Name , Host (OpenSearch Service endpoint without protocol), Port , Index , Type , Aws_auth , Aws_region , Suppress_Type_Name , and tls .

When you export logs to Amazon S3, you can specify the bucket using the bucket option. You can also specify region , total_file_size , upload_timeout , and use_put_object as options.

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}}'

See:

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

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 .

See:

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

MountPointProperty

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

Bases: object

The details for a volume mount point that’s 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 .

See:

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

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

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 .

See:

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

source_volume

The name of the volume to mount.

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

See:

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

PortMappingProperty

class CfnTaskDefinition.PortMappingProperty(*, app_protocol=None, container_port=None, container_port_range=None, host_port=None, name=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:
  • app_protocol (Optional[str]) – The application protocol that’s used for the port mapping. This parameter only applies to Service Connect. We recommend that you set this parameter to be consistent with the protocol that your application uses. If you set this parameter, Amazon ECS adds protocol-specific connection handling to the Service Connect proxy. If you set this parameter, Amazon ECS adds protocol-specific telemetry in the Amazon ECS console and CloudWatch. If you don’t set a value for this parameter, then TCP is used. However, Amazon ECS doesn’t add protocol-specific telemetry for TCP. appProtocol is immutable in a Service Connect service. Updating this field requires a service deletion and redeployment. Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

  • 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.

  • container_port_range (Optional[str]) – The port number range on the container that’s bound to the dynamically mapped host port range. The following rules apply when you specify a containerPortRange : - You must use either the bridge network mode or the awsvpc network mode. - This parameter is available for both the EC2 and AWS Fargate launch types. - This parameter is available for both the Linux and Windows operating systems. - The container instance must have at least version 1.67.0 of the container agent and at least version 1.67.0-1 of the ecs-init package - You can specify a maximum of 100 port ranges per container. - You do not specify a hostPortRange . The value of the hostPortRange is set as follows: - For containers in a task with the awsvpc network mode, the hostPortRange is set to the same value as the containerPortRange . This is a static mapping strategy. - For containers in a task with the bridge network mode, the Amazon ECS agent finds open host ports from the default ephemeral range and passes it to docker to bind them to the container ports. - The containerPortRange valid values are between 1 and 65535. - A port can only be included in one port mapping per container. - You cannot specify overlapping port ranges. - The first port in the range must be less than last port in the range. - Docker recommends that you turn off the docker-proxy in the Docker daemon config file when you have a large number of ports. For more information, see Issue #11185 on the Github website. For information about how to turn off the docker-proxy in the Docker daemon config file, see Docker daemon in the Amazon ECS Developer Guide . You can call `DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_ to view the hostPortRange which are the host ports that are bound to the container ports.

  • host_port (Union[int, float, None]) – The port number on the container instance to reserve for your container. If you specify a containerPortRange , leave this field empty and the value of the hostPort is set as follows: - For containers in a task with the awsvpc network mode, the hostPort is set to the same value as the containerPort . This is a static mapping strategy. - For containers in a task with the bridge network mode, the Amazon ECS agent finds open ports on the host and automatically binds them to the container ports. This is a dynamic mapping strategy. If you use 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 use 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 (Linux) or 49152 through 65535 (Windows) 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. 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. That is, 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. This number includes the default reserved ports. Automatically assigned ports aren’t included in the 100 reserved ports quota.

  • name (Optional[str]) – The name that’s used for the port mapping. This parameter is the name that you use in the serviceConnectConfiguration and the vpcLatticeConfigurations of a service. The name can include up to 64 characters. The characters can include lowercase letters, numbers, underscores (_), and hyphens (-). The name can’t start with a hyphen.

  • protocol (Optional[str]) – The protocol used for the port mapping. Valid values are tcp and udp . The default is tcp . protocol is immutable in a Service Connect service. Updating this field requires a service deletion and redeployment.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

port_mapping_property = ecs.CfnTaskDefinition.PortMappingProperty(
    app_protocol="appProtocol",
    container_port=123,
    container_port_range="containerPortRange",
    host_port=123,
    name="name",
    protocol="protocol"
)

Attributes

app_protocol

The application protocol that’s used for the port mapping.

This parameter only applies to Service Connect. We recommend that you set this parameter to be consistent with the protocol that your application uses. If you set this parameter, Amazon ECS adds protocol-specific connection handling to the Service Connect proxy. If you set this parameter, Amazon ECS adds protocol-specific telemetry in the Amazon ECS console and CloudWatch.

If you don’t set a value for this parameter, then TCP is used. However, Amazon ECS doesn’t add protocol-specific telemetry for TCP.

appProtocol is immutable in a Service Connect service. Updating this field requires a service deletion and redeployment.

Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

See:

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

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.

See:

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

container_port_range

The port number range on the container that’s bound to the dynamically mapped host port range.

The following rules apply when you specify a containerPortRange :

  • You must use either the bridge network mode or the awsvpc network mode.

  • This parameter is available for both the EC2 and AWS Fargate launch types.

  • This parameter is available for both the Linux and Windows operating systems.

  • The container instance must have at least version 1.67.0 of the container agent and at least version 1.67.0-1 of the ecs-init package

  • You can specify a maximum of 100 port ranges per container.

  • You do not specify a hostPortRange . The value of the hostPortRange is set as follows:

  • For containers in a task with the awsvpc network mode, the hostPortRange is set to the same value as the containerPortRange . This is a static mapping strategy.

  • For containers in a task with the bridge network mode, the Amazon ECS agent finds open host ports from the default ephemeral range and passes it to docker to bind them to the container ports.

  • The containerPortRange valid values are between 1 and 65535.

  • A port can only be included in one port mapping per container.

  • You cannot specify overlapping port ranges.

  • The first port in the range must be less than last port in the range.

  • Docker recommends that you turn off the docker-proxy in the Docker daemon config file when you have a large number of ports.

For more information, see Issue #11185 on the Github website.

For information about how to turn off the docker-proxy in the Docker daemon config file, see Docker daemon in the Amazon ECS Developer Guide .

You can call `DescribeTasks <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html>`_ to view the hostPortRange which are the host ports that are bound to the container ports.

See:

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

host_port

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

If you specify a containerPortRange , leave this field empty and the value of the hostPort is set as follows:

  • For containers in a task with the awsvpc network mode, the hostPort is set to the same value as the containerPort . This is a static mapping strategy.

  • For containers in a task with the bridge network mode, the Amazon ECS agent finds open ports on the host and automatically binds them to the container ports. This is a dynamic mapping strategy.

If you use 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 use 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 (Linux) or 49152 through 65535 (Windows) 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.

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. That is, 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. This number includes the default reserved ports. Automatically assigned ports aren’t included in the 100 reserved ports quota.

See:

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

name

The name that’s used for the port mapping.

This parameter is the name that you use in the serviceConnectConfiguration and the vpcLatticeConfigurations of a service. The name can include up to 64 characters. The characters can include lowercase letters, numbers, underscores (_), and hyphens (-). The name can’t start with a hyphen.

See:

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

protocol

The protocol used for the port mapping.

Valid values are tcp and udp . The default is tcp . protocol is immutable in a Service Connect service. Updating this field requires a service deletion and redeployment.

See:

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

ProxyConfigurationProperty

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

Bases: object

The configuration details for the App Mesh proxy.

For tasks that use 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 use 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

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 .

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

type

The proxy type.

The only supported value is APPMESH .

See:

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

RepositoryCredentialsProperty

class CfnTaskDefinition.RepositoryCredentialsProperty(*, credentials_parameter=None)

Bases: object

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.

See:

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.
from aws_cdk import 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.

See:

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

ResourceRequirementProperty

class CfnTaskDefinition.ResourceRequirementProperty(*, type, value)

Bases: object

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

The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide

Parameters:
  • type (str) – The type of resource to assign to a container.

  • value (str) – The value for the specified resource type. When the type is GPU , the value is the number of physical GPUs the Amazon ECS container agent reserves for the container. The number of GPUs that’s reserved for all containers in a task can’t exceed the number of available GPUs on the container instance that the task is launched on. When the type is InferenceAccelerator , the value matches the deviceName for an InferenceAccelerator specified in a task definition.

See:

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.
from aws_cdk import 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.

See:

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

value

The value for the specified resource type.

When the type is GPU , the value is the number of physical GPUs the Amazon ECS container agent reserves for the container. The number of GPUs that’s reserved for all containers in a task can’t exceed the number of available GPUs on the container instance that the task is launched on.

When the type is InferenceAccelerator , the value matches the deviceName for an InferenceAccelerator specified in a task definition.

See:

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

RestartPolicyProperty

class CfnTaskDefinition.RestartPolicyProperty(*, enabled=None, ignored_exit_codes=None, restart_attempt_period=None)

Bases: object

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

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

Parameters:
  • enabled (Union[bool, IResolvable, None]) – Specifies whether a restart policy is enabled for the container.

  • ignored_exit_codes (Union[IResolvable, Sequence[Union[int, float]], None]) – A list of exit codes that Amazon ECS will ignore and not attempt a restart on. You can specify a maximum of 50 container exit codes. By default, Amazon ECS does not ignore any exit codes.

  • restart_attempt_period (Union[int, float, None]) – A period of time (in seconds) that the container must run for before a restart can be attempted. A container can be restarted only once every restartAttemptPeriod seconds. If a container isn’t able to run for this time period and exits early, it will not be restarted. You can set a minimum restartAttemptPeriod of 60 seconds and a maximum restartAttemptPeriod of 1800 seconds. By default, a container must run for 300 seconds before it can be restarted.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

restart_policy_property = ecs.CfnTaskDefinition.RestartPolicyProperty(
    enabled=False,
    ignored_exit_codes=[123],
    restart_attempt_period=123
)

Attributes

enabled

Specifies whether a restart policy is enabled for the container.

See:

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

ignored_exit_codes

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

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

See:

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

restart_attempt_period

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

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

See:

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

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 information 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 available for tasks that run on Linux Amazon EC2 instance or Linux containers on Fargate.

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

See:

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.
from aws_cdk import 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 available for tasks that run on Linux Amazon EC2 instance or Linux containers on Fargate.

See:

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

operating_system_family

The operating system.

See:

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

SecretProperty

class CfnTaskDefinition.SecretProperty(*, name, value_from)

Bases: object

An object representing the secret to expose to your container.

Secrets can be exposed to a container in the following ways:

  • To inject sensitive data into your containers as environment variables, use the secrets container definition parameter.

  • To reference sensitive information in the log configuration of a container, use the secretOptions container definition parameter.

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.

See:

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.
from aws_cdk import aws_ecs as ecs

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

Attributes

name

The name of the secret.

See:

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

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.
See:

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

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 docker container create command and the --sysctl option to docker run. For example, you can configure net.ipv4.tcp_keepalive_time setting to maintain longer lived connections.

We don’t recommend that you specify network-related systemControls parameters for multiple containers in a single task that also uses either the awsvpc or host network mode. Doing this has the following disadvantages:

  • For tasks that use the awsvpc network mode including Fargate, 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 network namespace systemControls aren’t supported.

If you’re setting an IPC resource namespace to use for the containers in the task, the following conditions apply to your system controls. For more information, see IPC mode .

  • For tasks that use the host IPC mode, IPC namespace systemControls aren’t supported.

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

This parameter is not supported for Windows containers. > This parameter is only supported for tasks that are hosted on AWS Fargate if the tasks are using platform version 1.4.0 or later (Linux). This isn’t supported for Windows containers on Fargate.

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

  • value (Optional[str]) – The namespaced kernel parameter to set a value for. Valid IPC namespace values: "kernel.msgmax" | "kernel.msgmnb" | "kernel.msgmni" | "kernel.sem" | "kernel.shmall" | "kernel.shmmax" | "kernel.shmmni" | "kernel.shm_rmid_forced" , and Sysctls that start with "fs.mqueue.*" Valid network namespace values: Sysctls that start with "net.*" All of these values are supported by Fargate.

See:

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.
from aws_cdk import 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.

See:

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

value

The namespaced kernel parameter to set a value for.

Valid IPC namespace values: "kernel.msgmax" | "kernel.msgmnb" | "kernel.msgmni" | "kernel.sem" | "kernel.shmall" | "kernel.shmmax" | "kernel.shmmni" | "kernel.shm_rmid_forced" , and Sysctls that start with "fs.mqueue.*"

Valid network namespace values: Sysctls that start with "net.*"

All of these values are supported by Fargate.

See:

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

TaskDefinitionPlacementConstraintProperty

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

Bases: object

The constraint on task placement in the task definition.

For more information, see Task placement constraints in the Amazon Elastic Container Service Developer Guide . .. epigraph:

Task placement constraints aren't supported for tasks run on AWS Fargate .
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 .

See:

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.
from aws_cdk import 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 .

See:

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

type

The type of constraint.

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

See:

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

TmpfsProperty

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

Bases: object

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"

See:

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.
from aws_cdk import 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.

See:

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

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"

See:

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

size

The maximum size (in MiB) of the tmpfs volume.

See:

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

UlimitProperty

class CfnTaskDefinition.UlimitProperty(*, hard_limit, name, soft_limit)

Bases: object

The ulimit settings to pass to the container.

Amazon ECS tasks hosted on AWS Fargate use the default resource limit values set by the operating system with the exception of the nofile resource limit parameter which AWS Fargate overrides. The nofile resource limit sets a restriction on the number of open files that a container can use. The default nofile soft limit is 65535 and the default hard limit is 65535 .

You can specify the ulimit settings for a container in a task definition.

Parameters:
  • hard_limit (Union[int, float]) – The hard limit for the ulimit type. The value can be specified in bytes, seconds, or as a count, depending on the type of the ulimit .

  • name (str) – The type of the ulimit .

  • soft_limit (Union[int, float]) – The soft limit for the ulimit type. The value can be specified in bytes, seconds, or as a count, depending on the type of the ulimit .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-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.
from aws_cdk import 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.

The value can be specified in bytes, seconds, or as a count, depending on the type of the ulimit .

See:

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

name

The type of the ulimit .

See:

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

soft_limit

The soft limit for the ulimit type.

The value can be specified in bytes, seconds, or as a count, depending on the type of the ulimit .

See:

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

VolumeFromProperty

class CfnTaskDefinition.VolumeFromProperty(*, read_only=None, source_container=None)

Bases: object

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.

See:

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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 .

See:

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

source_container

The name of another container within the same task definition to mount volumes from.

See:

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

VolumeProperty

class CfnTaskDefinition.VolumeProperty(*, configured_at_launch=None, docker_volume_configuration=None, efs_volume_configuration=None, f_sx_windows_file_server_volume_configuration=None, host=None, name=None)

Bases: object

The data volume configuration for tasks launched using this task definition.

Specifying a volume configuration in a task definition is optional. The volume configuration may contain multiple volumes but only one volume configured at launch is supported. Each volume defined in the volume configuration may only specify a name and one of either configuredAtLaunch , dockerVolumeConfiguration , efsVolumeConfiguration , fsxWindowsFileServerVolumeConfiguration , or host . If an empty volume configuration is specified, by default Amazon ECS uses a host volume. For more information, see Using data volumes in tasks .

Parameters:
  • configured_at_launch (Union[bool, IResolvable, None]) – Indicates whether the volume should be configured at launch time. This is used to create Amazon EBS volumes for standalone tasks or tasks created as part of a service. Each task definition revision may only have one volume configured at launch in the volume configuration. To configure a volume at launch time, use this task definition revision and specify a volumeConfigurations object when calling the CreateService , UpdateService , RunTask or StartTask APIs.

  • 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.

  • f_sx_windows_file_server_volume_configuration (Union[IResolvable, FSxWindowsFileServerVolumeConfigurationProperty, Dict[str, Any], None]) – This parameter is specified when you use Amazon FSx for Windows File Server 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. When using a volume configured at launch, the name is required and must also be specified as the volume name in the ServiceVolumeConfiguration or TaskVolumeConfiguration parameter when creating your service or standalone task. For all other types of volumes, this name is referenced in the sourceVolume parameter of the mountPoints object in the container definition. When a volume is using the efsVolumeConfiguration , the name is required.

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

volume_property = ecs.CfnTaskDefinition.VolumeProperty(
    configured_at_launch=False,
    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
    ),
    f_sx_windows_file_server_volume_configuration=ecs.CfnTaskDefinition.FSxWindowsFileServerVolumeConfigurationProperty(
        file_system_id="fileSystemId",
        root_directory="rootDirectory",

        # the properties below are optional
        authorization_config=ecs.CfnTaskDefinition.FSxAuthorizationConfigProperty(
            credentials_parameter="credentialsParameter",
            domain="domain"
        )
    ),
    host=ecs.CfnTaskDefinition.HostVolumePropertiesProperty(
        source_path="sourcePath"
    ),
    name="name"
)

Attributes

configured_at_launch

Indicates whether the volume should be configured at launch time.

This is used to create Amazon EBS volumes for standalone tasks or tasks created as part of a service. Each task definition revision may only have one volume configured at launch in the volume configuration.

To configure a volume at launch time, use this task definition revision and specify a volumeConfigurations object when calling the CreateService , UpdateService , RunTask or StartTask APIs.

See:

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

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 .
See:

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

efs_volume_configuration

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

See:

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

f_sx_windows_file_server_volume_configuration

This parameter is specified when you use Amazon FSx for Windows File Server file system for task storage.

See:

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

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 .

See:

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

name

The name of the volume. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.

When using a volume configured at launch, the name is required and must also be specified as the volume name in the ServiceVolumeConfiguration or TaskVolumeConfiguration parameter when creating your service or standalone task.

For all other types of volumes, this name is referenced in the sourceVolume parameter of the mountPoints object in the container definition.

When a volume is using the efsVolumeConfiguration , the name is required.

See:

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