@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.302Z") @Stability(value=Stable) public class CfnSpotFleet extends CfnResource implements IInspectable
Specifies a Spot Fleet request. A Spot Fleet request contains the configuration information to launch a fleet, or group, of instances.
The Spot Fleet request specifies the total target capacity and the On-Demand target capacity for the fleet. Amazon EC2 calculates the difference between the total capacity and On-Demand capacity, and launches the difference as Spot capacity.
The Spot Fleet request can include multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet.
By default, the Spot Fleet requests Spot Instances in the Spot 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 Instances. You cannot tag other resource types in a Spot Fleet request because only the instance resource type is supported.
For more information, see Spot Fleet Requests in the Amazon EC2 User Guide for Linux Instances .
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
CfnSpotFleet cfnSpotFleet = CfnSpotFleet.Builder.create(this, "MyCfnSpotFleet")
.spotFleetRequestConfigData(SpotFleetRequestConfigDataProperty.builder()
.iamFleetRole("iamFleetRole")
.targetCapacity(123)
// the properties below are optional
.allocationStrategy("allocationStrategy")
.context("context")
.excessCapacityTerminationPolicy("excessCapacityTerminationPolicy")
.instanceInterruptionBehavior("instanceInterruptionBehavior")
.instancePoolsToUseCount(123)
.launchSpecifications(List.of(SpotFleetLaunchSpecificationProperty.builder()
.imageId("imageId")
// the properties below are optional
.blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder()
.deviceName("deviceName")
// the properties below are optional
.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())
.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"))
.bareMetal("bareMetal")
.baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.burstablePerformance("burstablePerformance")
.cpuManufacturers(List.of("cpuManufacturers"))
.excludedInstanceTypes(List.of("excludedInstanceTypes"))
.instanceGenerations(List.of("instanceGenerations"))
.localStorage("localStorage")
.localStorageTypes(List.of("localStorageTypes"))
.memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
.max(123)
.min(123)
.build())
.memoryMiB(MemoryMiBRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.onDemandMaxPricePercentageOverLowestPrice(123)
.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()
.privateIpAddress("privateIpAddress")
// the properties below are optional
.primary(false)
.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()
.version("version")
// the properties below are optional
.launchTemplateId("launchTemplateId")
.launchTemplateName("launchTemplateName")
.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"))
.bareMetal("bareMetal")
.baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.burstablePerformance("burstablePerformance")
.cpuManufacturers(List.of("cpuManufacturers"))
.excludedInstanceTypes(List.of("excludedInstanceTypes"))
.instanceGenerations(List.of("instanceGenerations"))
.localStorage("localStorage")
.localStorageTypes(List.of("localStorageTypes"))
.memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
.max(123)
.min(123)
.build())
.memoryMiB(MemoryMiBRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.onDemandMaxPricePercentageOverLowestPrice(123)
.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")
.targetCapacityUnitType("targetCapacityUnitType")
.terminateInstancesWithExpiration(false)
.type("type")
.validFrom("validFrom")
.validUntil("validUntil")
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static interface |
CfnSpotFleet.AcceleratorCountRequestProperty
The minimum and maximum number of accelerators (GPUs, FPGAs, or AWS Inferentia chips) on an instance.
|
static interface |
CfnSpotFleet.AcceleratorTotalMemoryMiBRequestProperty
The minimum and maximum amount of total accelerator memory, in MiB.
|
static interface |
CfnSpotFleet.BaselineEbsBandwidthMbpsRequestProperty
The minimum and maximum baseline bandwidth to Amazon EBS, in Mbps.
|
static interface |
CfnSpotFleet.BlockDeviceMappingProperty
Specifies a block device mapping.
|
static class |
CfnSpotFleet.Builder
A fluent builder for
CfnSpotFleet. |
static interface |
CfnSpotFleet.ClassicLoadBalancerProperty
Specifies a Classic Load Balancer.
|
static interface |
CfnSpotFleet.ClassicLoadBalancersConfigProperty
Specifies the Classic Load Balancers to attach to a Spot Fleet.
|
static interface |
CfnSpotFleet.EbsBlockDeviceProperty
Describes a block device for an EBS volume.
|
static interface |
CfnSpotFleet.FleetLaunchTemplateSpecificationProperty
Describes the Amazon EC2 launch template and the launch template version that can be used by a Spot Fleet request to configure Amazon EC2 instances.
|
static interface |
CfnSpotFleet.GroupIdentifierProperty
Describes a security group.
|
static interface |
CfnSpotFleet.IamInstanceProfileSpecificationProperty
Describes an IAM instance profile.
|
static interface |
CfnSpotFleet.InstanceIpv6AddressProperty
Describes an IPv6 address.
|
static interface |
CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty
Describes a network interface.
|
static interface |
CfnSpotFleet.InstanceRequirementsRequestProperty
The attributes for the instance types.
|
static interface |
CfnSpotFleet.LaunchTemplateConfigProperty
Specifies a launch template and overrides.
|
static interface |
CfnSpotFleet.LaunchTemplateOverridesProperty
Specifies overrides for a launch template.
|
static interface |
CfnSpotFleet.LoadBalancersConfigProperty
Specifies the Classic Load Balancers and target groups to attach to a Spot Fleet request.
|
static interface |
CfnSpotFleet.MemoryGiBPerVCpuRequestProperty
The minimum and maximum amount of memory per vCPU, in GiB.
|
static interface |
CfnSpotFleet.MemoryMiBRequestProperty
The minimum and maximum amount of memory, in MiB.
|
static interface |
CfnSpotFleet.NetworkInterfaceCountRequestProperty
The minimum and maximum number of network interfaces.
|
static interface |
CfnSpotFleet.PrivateIpAddressSpecificationProperty
Describes a secondary private IPv4 address for a network interface.
|
static interface |
CfnSpotFleet.SpotCapacityRebalanceProperty
The Spot Instance replacement strategy to use when Amazon EC2 emits a signal that your Spot Instance is at an elevated risk of being interrupted.
|
static interface |
CfnSpotFleet.SpotFleetLaunchSpecificationProperty
Specifies the launch specification for one or more Spot Instances.
|
static interface |
CfnSpotFleet.SpotFleetMonitoringProperty
Describes whether monitoring is enabled.
|
static interface |
CfnSpotFleet.SpotFleetRequestConfigDataProperty
Specifies the configuration of a Spot Fleet request.
|
static interface |
CfnSpotFleet.SpotFleetTagSpecificationProperty
The tags for a Spot Fleet resource.
|
static interface |
CfnSpotFleet.SpotMaintenanceStrategiesProperty
The strategies for managing your Spot Instances that are at an elevated risk of being interrupted.
|
static interface |
CfnSpotFleet.SpotPlacementProperty
Describes Spot Instance placement.
|
static interface |
CfnSpotFleet.TargetGroupProperty
Describes a load balancer target group.
|
static interface |
CfnSpotFleet.TargetGroupsConfigProperty
Describes the target groups to attach to a Spot Fleet.
|
static interface |
CfnSpotFleet.TotalLocalStorageGBRequestProperty
The minimum and maximum amount of total local storage, in GB.
|
static interface |
CfnSpotFleet.VCpuCountRangeRequestProperty
The minimum and maximum number of vCPUs.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnSpotFleet(software.constructs.Construct scope,
String id,
CfnSpotFleetProps props)
Create a new `AWS::EC2::SpotFleet`.
|
protected |
CfnSpotFleet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnSpotFleet(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
String |
getAttrId()
The ID of the Spot Fleet.
|
protected Map<String,Object> |
getCfnProperties() |
Object |
getSpotFleetRequestConfigData()
Describes the configuration of a Spot Fleet request.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setSpotFleetRequestConfigData(CfnSpotFleet.SpotFleetRequestConfigDataProperty value)
Describes the configuration of a Spot Fleet request.
|
void |
setSpotFleetRequestConfigData(IResolvable value)
Describes the configuration of a Spot Fleet request.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnSpotFleet(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnSpotFleet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnSpotFleet(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnSpotFleetProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrId()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public Object getSpotFleetRequestConfigData()
@Stability(value=Stable)
public void setSpotFleetRequestConfigData(@NotNull
CfnSpotFleet.SpotFleetRequestConfigDataProperty value)
@Stability(value=Stable)
public void setSpotFleetRequestConfigData(@NotNull
IResolvable value)
Copyright © 2022. All rights reserved.