EcsFargateLaunchTargetOptions

class aws_cdk.aws_stepfunctions_tasks.EcsFargateLaunchTargetOptions(*, platform_version, capacity_provider_options=None)

Bases: object

Properties to define an ECS service.

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.

  • capacity_provider_options (Optional[CapacityProviderOptions]) – The capacity provider options to use for the task. This property allows you to set the capacity provider strategy for the task. If you want to set the capacity provider strategy for the task, specify CapacityProviderOptions.custom(). This is required to use the FARGATE_SPOT capacity provider. If you want to use the cluster’s default capacity provider strategy, specify CapacityProviderOptions.default(). Default: - ‘FARGATE’ LaunchType running tasks on AWS Fargate On-Demand infrastructure is used without the capacity provider strategy.

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
)

# Use custom() option - specify custom capacity provider strategy
run_task_with_custom = tasks.EcsRunTask(self, "RunTaskWithCustom",
    cluster=cluster,
    task_definition=task_definition,
    launch_target=tasks.EcsFargateLaunchTarget(
        platform_version=ecs.FargatePlatformVersion.VERSION1_4,
        capacity_provider_options=tasks.CapacityProviderOptions.custom([capacity_provider="FARGATE_SPOT", weight=2, base=1, capacity_provider="FARGATE", weight=1
        ])
    )
)

# Use default() option - uses cluster's default capacity provider strategy
run_task_with_default = tasks.EcsRunTask(self, "RunTaskWithDefault",
    cluster=cluster,
    task_definition=task_definition,
    launch_target=tasks.EcsFargateLaunchTarget(
        platform_version=ecs.FargatePlatformVersion.VERSION1_4,
        capacity_provider_options=tasks.CapacityProviderOptions.default()
    )
)

Attributes

capacity_provider_options

The capacity provider options to use for the task.

This property allows you to set the capacity provider strategy for the task.

If you want to set the capacity provider strategy for the task, specify CapacityProviderOptions.custom(). This is required to use the FARGATE_SPOT capacity provider.

If you want to use the cluster’s default capacity provider strategy, specify CapacityProviderOptions.default().

Default:

  • ‘FARGATE’ LaunchType running tasks on AWS Fargate On-Demand

infrastructure is used without the capacity provider strategy.

platform_version

Refers to a specific runtime environment for Fargate task infrastructure.

Fargate platform version is a combination of the kernel and container runtime versions.

See:

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