EcsRunTaskProps

class aws_cdk.aws_stepfunctions_tasks.EcsRunTaskProps(*, comment=None, credentials=None, heartbeat=None, heartbeat_timeout=None, input_path=None, integration_pattern=None, output_path=None, result_path=None, result_selector=None, state_name=None, task_timeout=None, timeout=None, cluster, launch_target, task_definition, assign_public_ip=None, container_overrides=None, cpu=None, enable_execute_command=None, memory_mib=None, propagated_tag_source=None, revision_number=None, security_groups=None, subnets=None)

Bases: TaskStateBaseProps

Properties for ECS Tasks.

Parameters:
  • comment (Optional[str]) – An optional description for this state. Default: - No comment

  • credentials (Union[Credentials, Dict[str, Any], None]) – Credentials for an IAM Role that the State Machine assumes for executing the task. This enables cross-account resource invocations. Default: - None (Task is executed using the State Machine’s execution role)

  • heartbeat (Optional[Duration]) – (deprecated) Timeout for the heartbeat. Default: - None

  • heartbeat_timeout (Optional[Timeout]) – Timeout for the heartbeat. [disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface Default: - None

  • input_path (Optional[str]) – JSONPath expression to select part of the state to be the input to this state. May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}. Default: - The entire task input (JSON path ‘$’)

  • integration_pattern (Optional[IntegrationPattern]) – AWS Step Functions integrates with services directly in the Amazon States Language. You can control these AWS services using service integration patterns. Depending on the AWS Service, the Service Integration Pattern availability will vary. Default: - IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.

  • output_path (Optional[str]) – JSONPath expression to select select a portion of the state output to pass to the next state. May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}. Default: - The entire JSON node determined by the state input, the task result, and resultPath is passed to the next state (JSON path ‘$’)

  • result_path (Optional[str]) – JSONPath expression to indicate where to inject the state’s output. May also be the special value JsonPath.DISCARD, which will cause the state’s input to become its output. Default: - Replaces the entire input with the result (JSON path ‘$’)

  • result_selector (Optional[Mapping[str, Any]]) – The JSON that will replace the state’s raw result and become the effective result before ResultPath is applied. You can use ResultSelector to create a payload with values that are static or selected from the state’s raw result. Default: - None

  • state_name (Optional[str]) – Optional name for this state. Default: - The construct ID will be used as state name

  • task_timeout (Optional[Timeout]) – Timeout for the task. [disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface Default: - None

  • timeout (Optional[Duration]) – (deprecated) Timeout for the task. Default: - None

  • cluster (ICluster) – The ECS cluster to run the task on.

  • launch_target (IEcsLaunchTarget) – An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted.

  • task_definition (TaskDefinition) – [disable-awslint:ref-via-interface] Task Definition used for running tasks in the service. Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using CustomState

  • assign_public_ip (Optional[bool]) – Assign public IP addresses to each task. Default: false

  • container_overrides (Optional[Sequence[Union[ContainerOverride, Dict[str, Any]]]]) – Container setting overrides. Specify the container to use and the overrides to apply. Default: - No overrides

  • cpu (Optional[str]) – Cpu setting override. Default: - No override

  • enable_execute_command (Optional[bool]) – Whether ECS Exec should be enabled. Default: false

  • memory_mib (Optional[str]) – Memory setting override. Default: - No override

  • propagated_tag_source (Optional[PropagatedTagSource]) – Specifies whether to propagate the tags from the task definition to the task. An error will be received if you specify the SERVICE option when running a task. Default: - No tags are propagated.

  • revision_number (Union[int, float, None]) – The revision number of ECS task definition family. Default: - ‘$latest’

  • security_groups (Optional[Sequence[ISecurityGroup]]) – Existing security groups to use for the tasks. Default: - A new security group is created

  • subnets (Union[SubnetSelection, Dict[str, Any], None]) – Subnets to place the task’s ENIs. Default: - Public subnets if assignPublicIp is set. Private subnets otherwise.

ExampleMetadata:

infused

Example:

vpc = ec2.Vpc.from_lookup(self, "Vpc",
    is_default=True
)

cluster = ecs.Cluster(self, "FargateCluster", vpc=vpc)

task_definition = ecs.TaskDefinition(self, "TD",
    memory_mi_b="512",
    cpu="256",
    compatibility=ecs.Compatibility.FARGATE
)

container_definition = task_definition.add_container("TheContainer",
    image=ecs.ContainerImage.from_registry("foo/bar"),
    memory_limit_mi_b=256
)

run_task = tasks.EcsRunTask(self, "RunFargate",
    integration_pattern=sfn.IntegrationPattern.RUN_JOB,
    cluster=cluster,
    task_definition=task_definition,
    assign_public_ip=True,
    container_overrides=[tasks.ContainerOverride(
        container_definition=container_definition,
        environment=[tasks.TaskEnvironmentVariable(name="SOME_KEY", value=sfn.JsonPath.string_at("$.SomeKey"))]
    )],
    launch_target=tasks.EcsFargateLaunchTarget(),
    propagated_tag_source=ecs.PropagatedTagSource.TASK_DEFINITION
)

Attributes

assign_public_ip

Assign public IP addresses to each task.

Default:

false

cluster

The ECS cluster to run the task on.

comment

An optional description for this state.

Default:
  • No comment

container_overrides

Container setting overrides.

Specify the container to use and the overrides to apply.

Default:
  • No overrides

cpu

Cpu setting override.

Default:
  • No override

See:

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskOverride.html

credentials

Credentials for an IAM Role that the State Machine assumes for executing the task.

This enables cross-account resource invocations.

Default:
  • None (Task is executed using the State Machine’s execution role)

See:

https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html

enable_execute_command

Whether ECS Exec should be enabled.

Default:

false

See:

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html#ECS-RunTask-request-enableExecuteCommand

heartbeat

(deprecated) Timeout for the heartbeat.

Default:
  • None

Deprecated:

use heartbeatTimeout

Stability:

deprecated

heartbeat_timeout

Timeout for the heartbeat.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface

Default:
  • None

input_path

JSONPath expression to select part of the state to be the input to this state.

May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.

Default:
  • The entire task input (JSON path ‘$’)

integration_pattern

AWS Step Functions integrates with services directly in the Amazon States Language.

You can control these AWS services using service integration patterns.

Depending on the AWS Service, the Service Integration Pattern availability will vary.

Default:

  • IntegrationPattern.REQUEST_RESPONSE for most tasks.

IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.

See:

https://docs.aws.amazon.com/step-functions/latest/dg/connect-supported-services.html

launch_target

An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted.

See:

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html

memory_mib

Memory setting override.

Default:
  • No override

See:

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskOverride.html

output_path

JSONPath expression to select select a portion of the state output to pass to the next state.

May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.

Default:

  • The entire JSON node determined by the state input, the task result,

and resultPath is passed to the next state (JSON path ‘$’)

propagated_tag_source

Specifies whether to propagate the tags from the task definition to the task.

An error will be received if you specify the SERVICE option when running a task.

Default:
  • No tags are propagated.

See:

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html#ECS-RunTask-request-propagateTags

result_path

JSONPath expression to indicate where to inject the state’s output.

May also be the special value JsonPath.DISCARD, which will cause the state’s input to become its output.

Default:
  • Replaces the entire input with the result (JSON path ‘$’)

result_selector

The JSON that will replace the state’s raw result and become the effective result before ResultPath is applied.

You can use ResultSelector to create a payload with values that are static or selected from the state’s raw result.

Default:
  • None

See:

https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector

revision_number

The revision number of ECS task definition family.

Default:
  • ‘$latest’

security_groups

Existing security groups to use for the tasks.

Default:
  • A new security group is created

state_name

Optional name for this state.

Default:
  • The construct ID will be used as state name

subnets

Subnets to place the task’s ENIs.

Default:
  • Public subnets if assignPublicIp is set. Private subnets otherwise.

task_definition

ref-via-interface] Task Definition used for running tasks in the service.

Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using CustomState

Type:

[disable-awslint

task_timeout

Timeout for the task.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface

Default:
  • None

timeout

(deprecated) Timeout for the task.

Default:
  • None

Deprecated:

use taskTimeout

Stability:

deprecated