Class CfnSpotFleetPropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.mixins.preview.core.Mixin
software.amazon.awscdk.mixins.preview.services.ec2.mixins.CfnSpotFleetPropsMixin
All Implemented Interfaces:
IMixin, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.121.0 (build d7af9b9)", date="2025-12-18T18:20:25.360Z") @Stability(Stable) public class CfnSpotFleetPropsMixin extends Mixin implements IMixin
Specifies a Spot Fleet request.

The Spot Fleet request specifies the total target capacity and the On-Demand target capacity. Amazon EC2 calculates the difference between the total capacity and On-Demand capacity, and launches the difference as Spot capacity.

You can submit a single request that includes multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet.

By default, the Spot Fleet requests Spot Instances in the Spot Instance pool where the price per unit is the lowest. Each launch specification can include its own instance weighting that reflects the value of the instance type to your application workload.

Alternatively, you can specify that the Spot Fleet distribute the target capacity across the Spot pools included in its launch specifications. By ensuring that the Spot Instances in your Spot Fleet are in different Spot pools, you can improve the availability of your fleet.

You can specify tags for the Spot Fleet request and instances launched by the fleet. You cannot tag other resource types in a Spot Fleet request because only the spot-fleet-request and instance resource types are supported.

For more information, see Spot Fleet in the Amazon EC2 User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.mixins.preview.mixins.*;
 import software.amazon.awscdk.mixins.preview.services.ec2.mixins.*;
 CfnSpotFleetPropsMixin cfnSpotFleetPropsMixin = CfnSpotFleetPropsMixin.Builder.create(CfnSpotFleetMixinProps.builder()
         .spotFleetRequestConfigData(SpotFleetRequestConfigDataProperty.builder()
                 .allocationStrategy("allocationStrategy")
                 .context("context")
                 .excessCapacityTerminationPolicy("excessCapacityTerminationPolicy")
                 .iamFleetRole("iamFleetRole")
                 .instanceInterruptionBehavior("instanceInterruptionBehavior")
                 .instancePoolsToUseCount(123)
                 .launchSpecifications(List.of(SpotFleetLaunchSpecificationProperty.builder()
                         .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder()
                                 .deviceName("deviceName")
                                 .ebs(EbsBlockDeviceProperty.builder()
                                         .deleteOnTermination(false)
                                         .encrypted(false)
                                         .iops(123)
                                         .snapshotId("snapshotId")
                                         .volumeSize(123)
                                         .volumeType("volumeType")
                                         .build())
                                 .noDevice("noDevice")
                                 .virtualName("virtualName")
                                 .build()))
                         .ebsOptimized(false)
                         .iamInstanceProfile(IamInstanceProfileSpecificationProperty.builder()
                                 .arn("arn")
                                 .build())
                         .imageId("imageId")
                         .instanceRequirements(InstanceRequirementsRequestProperty.builder()
                                 .acceleratorCount(AcceleratorCountRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .acceleratorManufacturers(List.of("acceleratorManufacturers"))
                                 .acceleratorNames(List.of("acceleratorNames"))
                                 .acceleratorTotalMemoryMiB(AcceleratorTotalMemoryMiBRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .acceleratorTypes(List.of("acceleratorTypes"))
                                 .allowedInstanceTypes(List.of("allowedInstanceTypes"))
                                 .bareMetal("bareMetal")
                                 .baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .baselinePerformanceFactors(BaselinePerformanceFactorsRequestProperty.builder()
                                         .cpu(CpuPerformanceFactorRequestProperty.builder()
                                                 .references(List.of(PerformanceFactorReferenceRequestProperty.builder()
                                                         .instanceFamily("instanceFamily")
                                                         .build()))
                                                 .build())
                                         .build())
                                 .burstablePerformance("burstablePerformance")
                                 .cpuManufacturers(List.of("cpuManufacturers"))
                                 .excludedInstanceTypes(List.of("excludedInstanceTypes"))
                                 .instanceGenerations(List.of("instanceGenerations"))
                                 .localStorage("localStorage")
                                 .localStorageTypes(List.of("localStorageTypes"))
                                 .maxSpotPriceAsPercentageOfOptimalOnDemandPrice(123)
                                 .memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .memoryMiB(MemoryMiBRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .networkBandwidthGbps(NetworkBandwidthGbpsRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .onDemandMaxPricePercentageOverLowestPrice(123)
                                 .requireEncryptionInTransit(false)
                                 .requireHibernateSupport(false)
                                 .spotMaxPricePercentageOverLowestPrice(123)
                                 .totalLocalStorageGb(TotalLocalStorageGBRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .vCpuCount(VCpuCountRangeRequestProperty.builder()
                                         .max(123)
                                         .min(123)
                                         .build())
                                 .build())
                         .instanceType("instanceType")
                         .kernelId("kernelId")
                         .keyName("keyName")
                         .monitoring(SpotFleetMonitoringProperty.builder()
                                 .enabled(false)
                                 .build())
                         .networkInterfaces(List.of(InstanceNetworkInterfaceSpecificationProperty.builder()
                                 .associatePublicIpAddress(false)
                                 .deleteOnTermination(false)
                                 .description("description")
                                 .deviceIndex(123)
                                 .groups(List.of("groups"))
                                 .ipv6AddressCount(123)
                                 .ipv6Addresses(List.of(InstanceIpv6AddressProperty.builder()
                                         .ipv6Address("ipv6Address")
                                         .build()))
                                 .networkInterfaceId("networkInterfaceId")
                                 .privateIpAddresses(List.of(PrivateIpAddressSpecificationProperty.builder()
                                         .primary(false)
                                         .privateIpAddress("privateIpAddress")
                                         .build()))
                                 .secondaryPrivateIpAddressCount(123)
                                 .subnetId("subnetId")
                                 .build()))
                         .placement(SpotPlacementProperty.builder()
                                 .availabilityZone("availabilityZone")
                                 .groupName("groupName")
                                 .tenancy("tenancy")
                                 .build())
                         .ramdiskId("ramdiskId")
                         .securityGroups(List.of(GroupIdentifierProperty.builder()
                                 .groupId("groupId")
                                 .build()))
                         .spotPrice("spotPrice")
                         .subnetId("subnetId")
                         .tagSpecifications(List.of(SpotFleetTagSpecificationProperty.builder()
                                 .resourceType("resourceType")
                                 .tags(List.of(CfnTag.builder()
                                         .key("key")
                                         .value("value")
                                         .build()))
                                 .build()))
                         .userData("userData")
                         .weightedCapacity(123)
                         .build()))
                 .launchTemplateConfigs(List.of(LaunchTemplateConfigProperty.builder()
                         .launchTemplateSpecification(FleetLaunchTemplateSpecificationProperty.builder()
                                 .launchTemplateId("launchTemplateId")
                                 .launchTemplateName("launchTemplateName")
                                 .version("version")
                                 .build())
                         .overrides(List.of(LaunchTemplateOverridesProperty.builder()
                                 .availabilityZone("availabilityZone")
                                 .instanceRequirements(InstanceRequirementsRequestProperty.builder()
                                         .acceleratorCount(AcceleratorCountRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .acceleratorManufacturers(List.of("acceleratorManufacturers"))
                                         .acceleratorNames(List.of("acceleratorNames"))
                                         .acceleratorTotalMemoryMiB(AcceleratorTotalMemoryMiBRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .acceleratorTypes(List.of("acceleratorTypes"))
                                         .allowedInstanceTypes(List.of("allowedInstanceTypes"))
                                         .bareMetal("bareMetal")
                                         .baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .baselinePerformanceFactors(BaselinePerformanceFactorsRequestProperty.builder()
                                                 .cpu(CpuPerformanceFactorRequestProperty.builder()
                                                         .references(List.of(PerformanceFactorReferenceRequestProperty.builder()
                                                                 .instanceFamily("instanceFamily")
                                                                 .build()))
                                                         .build())
                                                 .build())
                                         .burstablePerformance("burstablePerformance")
                                         .cpuManufacturers(List.of("cpuManufacturers"))
                                         .excludedInstanceTypes(List.of("excludedInstanceTypes"))
                                         .instanceGenerations(List.of("instanceGenerations"))
                                         .localStorage("localStorage")
                                         .localStorageTypes(List.of("localStorageTypes"))
                                         .maxSpotPriceAsPercentageOfOptimalOnDemandPrice(123)
                                         .memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .memoryMiB(MemoryMiBRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .networkBandwidthGbps(NetworkBandwidthGbpsRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .onDemandMaxPricePercentageOverLowestPrice(123)
                                         .requireEncryptionInTransit(false)
                                         .requireHibernateSupport(false)
                                         .spotMaxPricePercentageOverLowestPrice(123)
                                         .totalLocalStorageGb(TotalLocalStorageGBRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .vCpuCount(VCpuCountRangeRequestProperty.builder()
                                                 .max(123)
                                                 .min(123)
                                                 .build())
                                         .build())
                                 .instanceType("instanceType")
                                 .priority(123)
                                 .spotPrice("spotPrice")
                                 .subnetId("subnetId")
                                 .weightedCapacity(123)
                                 .build()))
                         .build()))
                 .loadBalancersConfig(LoadBalancersConfigProperty.builder()
                         .classicLoadBalancersConfig(ClassicLoadBalancersConfigProperty.builder()
                                 .classicLoadBalancers(List.of(ClassicLoadBalancerProperty.builder()
                                         .name("name")
                                         .build()))
                                 .build())
                         .targetGroupsConfig(TargetGroupsConfigProperty.builder()
                                 .targetGroups(List.of(TargetGroupProperty.builder()
                                         .arn("arn")
                                         .build()))
                                 .build())
                         .build())
                 .onDemandAllocationStrategy("onDemandAllocationStrategy")
                 .onDemandMaxTotalPrice("onDemandMaxTotalPrice")
                 .onDemandTargetCapacity(123)
                 .replaceUnhealthyInstances(false)
                 .spotMaintenanceStrategies(SpotMaintenanceStrategiesProperty.builder()
                         .capacityRebalance(SpotCapacityRebalanceProperty.builder()
                                 .replacementStrategy("replacementStrategy")
                                 .terminationDelay(123)
                                 .build())
                         .build())
                 .spotMaxTotalPrice("spotMaxTotalPrice")
                 .spotPrice("spotPrice")
                 .tagSpecifications(List.of(SpotFleetTagSpecificationProperty.builder()
                         .resourceType("resourceType")
                         .tags(List.of(CfnTag.builder()
                                 .key("key")
                                 .value("value")
                                 .build()))
                         .build()))
                 .targetCapacity(123)
                 .targetCapacityUnitType("targetCapacityUnitType")
                 .terminateInstancesWithExpiration(false)
                 .type("type")
                 .validFrom("validFrom")
                 .validUntil("validUntil")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build())
 .strategy(PropertyMergeStrategy.OVERRIDE)
 .build();
 

See Also:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> CFN_PROPERTY_KEYS
  • Constructor Details

    • CfnSpotFleetPropsMixin

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

      protected CfnSpotFleetPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnSpotFleetPropsMixin

      @Stability(Stable) public CfnSpotFleetPropsMixin(@NotNull CfnSpotFleetMixinProps props, @Nullable CfnPropertyMixinOptions options)
      Create a mixin to apply properties to AWS::EC2::SpotFleet.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnSpotFleetPropsMixin

      @Stability(Stable) public CfnSpotFleetPropsMixin(@NotNull CfnSpotFleetMixinProps props)
      Create a mixin to apply properties to AWS::EC2::SpotFleet.

      Parameters:
      props - L1 properties to apply. This parameter is required.
  • Method Details

    • applyTo

      @Stability(Stable) @NotNull public software.constructs.IConstruct applyTo(@NotNull software.constructs.IConstruct construct)
      Apply the mixin properties to the construct.

      Specified by:
      applyTo in interface IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnSpotFleetMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected PropertyMergeStrategy getStrategy()