EcsFargateLaunchTarget

class aws_cdk.aws_stepfunctions_tasks.EcsFargateLaunchTarget(*, platform_version)

Bases: object

Configuration for running an ECS task on Fargate.

See:

https://docs.aws.amazon.com/AmazonECS/latest/userguide/launch_types.html#launch-type-fargate

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

platform_version (FargatePlatformVersion) – Refers to a specific runtime environment for Fargate task infrastructure. Fargate platform version is a combination of the kernel and container runtime versions.

Methods

bind(_task, *, task_definition, cluster=None)

Called when the Fargate launch type configured on RunTask.

Parameters:
  • _task (EcsRunTask) –

  • task_definition (ITaskDefinition) – Task definition to run Docker containers in Amazon ECS.

  • cluster (Optional[ICluster]) – A regional grouping of one or more container instances on which you can run tasks and services. Default: - No cluster

Return type:

EcsLaunchTargetConfig