TaskDefinitionAttributes

class aws_cdk.aws_ecs.TaskDefinitionAttributes(*, task_definition_arn, execution_role=None, network_mode=None, task_role=None, compatibility=None)

Bases: CommonTaskDefinitionAttributes

A reference to an existing task definition.

Parameters:
  • task_definition_arn (str) – The arn of the task definition.

  • execution_role (Optional[IRole]) – The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf. Some tasks do not have an execution role. Default: - undefined

  • network_mode (Optional[NetworkMode]) – The networking mode to use for the containers in the task. Default: Network mode cannot be provided to the imported task.

  • 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: Permissions cannot be granted to the imported task.

  • compatibility (Optional[Compatibility]) – What launch types this task definition should be compatible with. Default: Compatibility.EC2_AND_FARGATE

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
from aws_cdk import aws_iam as iam

# role: iam.Role

task_definition_attributes = ecs.TaskDefinitionAttributes(
    task_definition_arn="taskDefinitionArn",

    # the properties below are optional
    compatibility=ecs.Compatibility.EC2,
    execution_role=role,
    network_mode=ecs.NetworkMode.NONE,
    task_role=role
)

Attributes

compatibility

What launch types this task definition should be compatible with.

Default:

Compatibility.EC2_AND_FARGATE

execution_role

The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.

Some tasks do not have an execution role.

Default:
  • undefined

network_mode

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

Default:

Network mode cannot be provided to the imported task.

task_definition_arn

The arn of the task definition.

task_role

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

Default:

Permissions cannot be granted to the imported task.