Interface EcsFargateLaunchTargetOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
EcsFargateLaunchTargetOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-02T12:05:18.125Z") @Stability(Stable) public interface EcsFargateLaunchTargetOptions extends software.amazon.jsii.JsiiSerializable
Properties to define an ECS service.

Example:

 IVpc vpc = Vpc.fromLookup(this, "Vpc", VpcLookupOptions.builder()
         .isDefault(true)
         .build());
 Cluster cluster = Cluster.Builder.create(this, "FargateCluster").vpc(vpc).build();
 TaskDefinition taskDefinition = TaskDefinition.Builder.create(this, "TD")
         .memoryMiB("512")
         .cpu("256")
         .compatibility(Compatibility.FARGATE)
         .build();
 // Use custom() option - specify custom capacity provider strategy
 EcsRunTask runTaskWithCustom = EcsRunTask.Builder.create(this, "RunTaskWithCustom")
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .launchTarget(EcsFargateLaunchTarget.Builder.create()
                 .platformVersion(FargatePlatformVersion.VERSION1_4)
                 .capacityProviderOptions(CapacityProviderOptions.custom(List.of(CapacityProviderStrategy.builder().capacityProvider("FARGATE_SPOT").weight(2).base(1).build(), CapacityProviderStrategy.builder().capacityProvider("FARGATE").weight(1).build())))
                 .build())
         .build();
 // Use default() option - uses cluster's default capacity provider strategy
 EcsRunTask runTaskWithDefault = EcsRunTask.Builder.create(this, "RunTaskWithDefault")
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .launchTarget(EcsFargateLaunchTarget.Builder.create()
                 .platformVersion(FargatePlatformVersion.VERSION1_4)
                 .capacityProviderOptions(CapacityProviderOptions.default())
                 .build())
         .build();
 
  • Method Details

    • getPlatformVersion

      @Stability(Stable) @NotNull FargatePlatformVersion getPlatformVersion()
      Refers to a specific runtime environment for Fargate task infrastructure.

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

      See Also:
    • getCapacityProviderOptions

      @Stability(Stable) @Nullable default CapacityProviderOptions getCapacityProviderOptions()
      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.

    • builder

      @Stability(Stable) static EcsFargateLaunchTargetOptions.Builder builder()
      Returns:
      a EcsFargateLaunchTargetOptions.Builder of EcsFargateLaunchTargetOptions