Class CapacityProviderOptions

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.tasks.CapacityProviderOptions
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.125.0 (build fdbe357)", date="2026-01-09T10:20:27.661Z") @Stability(Stable) public class CapacityProviderOptions extends software.amazon.jsii.JsiiObject
Capacity provider options.

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();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    CapacityProviderOptions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    CapacityProviderOptions(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    custom(List<? extends CapacityProviderStrategy> capacityProviderStrategy)
    Use a custom capacity provider strategy.
    Use the cluster's default capacity provider strategy.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • CapacityProviderOptions

      protected CapacityProviderOptions(software.amazon.jsii.JsiiObjectRef objRef)
    • CapacityProviderOptions

      protected CapacityProviderOptions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • custom

      @Stability(Stable) @NotNull public static CapacityProviderOptions custom(@NotNull List<? extends CapacityProviderStrategy> capacityProviderStrategy)
      Use a custom capacity provider strategy.

      You can specify between 1 and 20 capacity providers.

      Parameters:
      capacityProviderStrategy - The capacity provider strategy to use for the task. This parameter is required.
    • doDefault

      @Stability(Stable) @NotNull public static CapacityProviderOptions doDefault()
      Use the cluster's default capacity provider strategy.