RunEcsEc2TaskProps

class aws_cdk.aws_stepfunctions_tasks.RunEcsEc2TaskProps(*, cluster, task_definition, container_overrides=None, integration_pattern=None, placement_constraints=None, placement_strategies=None, security_group=None, subnets=None)

Bases: CommonEcsRunTaskProps

(deprecated) Properties to run an ECS task on EC2 in StepFunctionsan ECS.

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

  • task_definition (TaskDefinition) – 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

  • container_overrides (Optional[Sequence[Union[ContainerOverride, Dict[str, Any]]]]) – Container setting overrides. Key is the name of the container to override, value is the values you want to override. Default: - No overrides

  • integration_pattern (Optional[ServiceIntegrationPattern]) – The service integration pattern indicates different ways to call RunTask in ECS. The valid value for Lambda is FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN. Default: FIRE_AND_FORGET

  • placement_constraints (Optional[Sequence[PlacementConstraint]]) – (deprecated) Placement constraints. Default: No constraints

  • placement_strategies (Optional[Sequence[PlacementStrategy]]) – (deprecated) Placement strategies. Default: No strategies

  • security_group (Optional[ISecurityGroup]) – (deprecated) Existing security group to use for the task’s ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: A new security group is created

  • subnets (Union[SubnetSelection, Dict[str, Any], None]) – (deprecated) In what subnets to place the task’s ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: Private subnets

Deprecated

use EcsRunTask and EcsRunTaskProps

Stability

deprecated

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_ec2 as ec2
import aws_cdk.aws_ecs as ecs
import aws_cdk.aws_stepfunctions as stepfunctions
import aws_cdk.aws_stepfunctions_tasks as stepfunctions_tasks

# cluster: ecs.Cluster
# container_definition: ecs.ContainerDefinition
# placement_constraint: ecs.PlacementConstraint
# placement_strategy: ecs.PlacementStrategy
# security_group: ec2.SecurityGroup
# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# task_definition: ecs.TaskDefinition

run_ecs_ec2_task_props = stepfunctions_tasks.RunEcsEc2TaskProps(
    cluster=cluster,
    task_definition=task_definition,

    # the properties below are optional
    container_overrides=[stepfunctions_tasks.ContainerOverride(
        container_definition=container_definition,

        # the properties below are optional
        command=["command"],
        cpu=123,
        environment=[stepfunctions_tasks.TaskEnvironmentVariable(
            name="name",
            value="value"
        )],
        memory_limit=123,
        memory_reservation=123
    )],
    integration_pattern=stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET,
    placement_constraints=[placement_constraint],
    placement_strategies=[placement_strategy],
    security_group=security_group,
    subnets=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnet_name="subnetName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.ISOLATED
    )
)

Attributes

cluster

The topic to run the task on.

container_overrides

Container setting overrides.

Key is the name of the container to override, value is the values you want to override.

Default
  • No overrides

integration_pattern

The service integration pattern indicates different ways to call RunTask in ECS.

The valid value for Lambda is FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN.

Default

FIRE_AND_FORGET

placement_constraints

(deprecated) Placement constraints.

Default

No constraints

Stability

deprecated

placement_strategies

(deprecated) Placement strategies.

Default

No strategies

Stability

deprecated

security_group

(deprecated) Existing security group to use for the task’s ENIs.

(Only applicable in case the TaskDefinition is configured for AwsVpc networking)

Default

A new security group is created

Stability

deprecated

subnets

(deprecated) In what subnets to place the task’s ENIs.

(Only applicable in case the TaskDefinition is configured for AwsVpc networking)

Default

Private subnets

Stability

deprecated

task_definition

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