interface EcsFargateLaunchTargetOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.StepFunctions.Tasks.EcsFargateLaunchTargetOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctionstasks#EcsFargateLaunchTargetOptions |
Java | software.amazon.awscdk.services.stepfunctions.tasks.EcsFargateLaunchTargetOptions |
Python | aws_cdk.aws_stepfunctions_tasks.EcsFargateLaunchTargetOptions |
TypeScript (source) | aws-cdk-lib » aws_stepfunctions_tasks » EcsFargateLaunchTargetOptions |
Properties to define an ECS service.
Example
const vpc = ec2.Vpc.fromLookup(this, 'Vpc', {
isDefault: true,
});
const cluster = new ecs.Cluster(this, 'FargateCluster', { vpc });
const taskDefinition = new ecs.TaskDefinition(this, 'TD', {
memoryMiB: '512',
cpu: '256',
compatibility: ecs.Compatibility.FARGATE,
});
// Use custom() option - specify custom capacity provider strategy
const runTaskWithCustom = new tasks.EcsRunTask(this, 'RunTaskWithCustom', {
cluster,
taskDefinition,
launchTarget: new tasks.EcsFargateLaunchTarget({
platformVersion: ecs.FargatePlatformVersion.VERSION1_4,
capacityProviderOptions: tasks.CapacityProviderOptions.custom([
{ capacityProvider: 'FARGATE_SPOT', weight: 2, base: 1 },
{ capacityProvider: 'FARGATE', weight: 1 },
]),
}),
});
// Use default() option - uses cluster's default capacity provider strategy
const runTaskWithDefault = new tasks.EcsRunTask(this, 'RunTaskWithDefault', {
cluster,
taskDefinition,
launchTarget: new tasks.EcsFargateLaunchTarget({
platformVersion: ecs.FargatePlatformVersion.VERSION1_4,
capacityProviderOptions: tasks.CapacityProviderOptions.default(),
}),
});
Properties
| Name | Type | Description |
|---|---|---|
| platform | Fargate | Refers to a specific runtime environment for Fargate task infrastructure. |
| capacity | Capacity | The capacity provider options to use for the task. |
platformVersion
Type:
Fargate
Refers to a specific runtime environment for Fargate task infrastructure.
Fargate platform version is a combination of the kernel and container runtime versions.
capacityProviderOptions?
Type:
Capacity
(optional, default: 'FARGATE' LaunchType running tasks on AWS Fargate On-Demand
infrastructure is used without the capacity provider strategy.)
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().

.NET
Go
Java
Python
TypeScript (