# EcsFargateLaunchTargetOptions

Properties to define an ECS service.

- Source: [`aws-stepfunctions-tasks/lib/ecs/run-task.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-task.ts#L154)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

```ts
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

- `capacityProviderOptions`: [CapacityProviderOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.CapacityProviderOptions.html) = '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()`.

  **Default:** 'FARGATE' LaunchType running tasks on AWS Fargate On-Demand infrastructure is used without the capacity provider strategy.

- `platformVersion`: [FargatePlatformVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FargatePlatformVersion.html) (required) — Refers to a specific runtime environment for Fargate task infrastructure.

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

## Used as props by

- [`EcsFargateLaunchTarget`](/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EcsFargateLaunchTarget)
