CommonTaskDefinitionProps

class aws_cdk.aws_ecs.CommonTaskDefinitionProps(*, execution_role=None, family=None, proxy_configuration=None, task_role=None, volumes=None)

Bases: object

The common properties for all task definitions.

For more information, see Task Definition Parameters.

Parameters:
  • execution_role (Optional[IRole]) – The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf. The role will be used to retrieve container images from ECR and create CloudWatch log groups. Default: - An execution role will be automatically created if you use ECR images in your task definition.

  • family (Optional[str]) – The name of a family that this task definition is registered to. A family groups multiple versions of a task definition. Default: - Automatically generated name.

  • proxy_configuration (Optional[ProxyConfiguration]) – The configuration details for the App Mesh proxy. Default: - No proxy configuration.

  • task_role (Optional[IRole]) – The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. Default: - A task role is automatically created for you.

  • volumes (Optional[Sequence[Union[Volume, Dict[str, Any]]]]) – The list of volume definitions for the task. For more information, see Task Definition Parameter Volumes. Default: - No volumes are passed to the Docker daemon on a container instance.

ExampleMetadata:

fixture=_generated

Example:

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

# proxy_configuration: ecs.ProxyConfiguration
# role: iam.Role

common_task_definition_props = ecs.CommonTaskDefinitionProps(
    execution_role=role,
    family="family",
    proxy_configuration=proxy_configuration,
    task_role=role,
    volumes=[ecs.Volume(
        name="name",

        # the properties below are optional
        docker_volume_configuration=ecs.DockerVolumeConfiguration(
            driver="driver",
            scope=ecs.Scope.TASK,

            # the properties below are optional
            autoprovision=False,
            driver_opts={
                "driver_opts_key": "driverOpts"
            },
            labels={
                "labels_key": "labels"
            }
        ),
        efs_volume_configuration=ecs.EfsVolumeConfiguration(
            file_system_id="fileSystemId",

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

Attributes

execution_role

The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

The role will be used to retrieve container images from ECR and create CloudWatch log groups.

Default:
  • An execution role will be automatically created if you use ECR images in your task definition.

family

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

A family groups multiple versions of a task definition.

Default:
  • Automatically generated name.

proxy_configuration

The configuration details for the App Mesh proxy.

Default:
  • No proxy configuration.

task_role

The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

Default:
  • A task role is automatically created for you.

volumes

The list of volume definitions for the task.

For more information, see Task Definition Parameter Volumes.

Default:
  • No volumes are passed to the Docker daemon on a container instance.