CapacityProviderOptions

class aws_cdk.aws_stepfunctions_tasks.CapacityProviderOptions(*args: Any, **kwargs)

Bases: object

Capacity provider options.

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

Static Methods

classmethod custom(capacity_provider_strategy)

Use a custom capacity provider strategy.

You can specify between 1 and 20 capacity providers.

Parameters:

capacity_provider_strategy (Sequence[Union[CapacityProviderStrategy, Dict[str, Any]]]) – The capacity provider strategy to use for the task.

Return type:

CapacityProviderOptions

classmethod default()

Use the cluster’s default capacity provider strategy.

Return type:

CapacityProviderOptions