Class CfnSpotFleet
A CloudFormation AWS::EC2::SpotFleet
.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class CfnSpotFleet : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnSpotFleet
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
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 for Linux Instances .
We strongly discourage using the RequestSpotFleet API because it is a legacy API with no planned investment. For options for requesting Spot Instances, see Which is the best Spot request method to use? in the Amazon EC2 User Guide for Linux Instances .
CloudformationResource: AWS::EC2::SpotFleet
Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var cfnSpotFleet = new CfnSpotFleet(this, "MyCfnSpotFleet", new CfnSpotFleetProps {
SpotFleetRequestConfigData = new SpotFleetRequestConfigDataProperty {
IamFleetRole = "iamFleetRole",
TargetCapacity = 123,
// the properties below are optional
AllocationStrategy = "allocationStrategy",
Context = "context",
ExcessCapacityTerminationPolicy = "excessCapacityTerminationPolicy",
InstanceInterruptionBehavior = "instanceInterruptionBehavior",
InstancePoolsToUseCount = 123,
LaunchSpecifications = new [] { new SpotFleetLaunchSpecificationProperty {
ImageId = "imageId",
// the properties below are optional
BlockDeviceMappings = new [] { new BlockDeviceMappingProperty {
DeviceName = "deviceName",
// the properties below are optional
Ebs = new EbsBlockDeviceProperty {
DeleteOnTermination = false,
Encrypted = false,
Iops = 123,
SnapshotId = "snapshotId",
VolumeSize = 123,
VolumeType = "volumeType"
},
NoDevice = "noDevice",
VirtualName = "virtualName"
} },
EbsOptimized = false,
IamInstanceProfile = new IamInstanceProfileSpecificationProperty {
Arn = "arn"
},
InstanceRequirements = new InstanceRequirementsRequestProperty {
AcceleratorCount = new AcceleratorCountRequestProperty {
Max = 123,
Min = 123
},
AcceleratorManufacturers = new [] { "acceleratorManufacturers" },
AcceleratorNames = new [] { "acceleratorNames" },
AcceleratorTotalMemoryMiB = new AcceleratorTotalMemoryMiBRequestProperty {
Max = 123,
Min = 123
},
AcceleratorTypes = new [] { "acceleratorTypes" },
AllowedInstanceTypes = new [] { "allowedInstanceTypes" },
BareMetal = "bareMetal",
BaselineEbsBandwidthMbps = new BaselineEbsBandwidthMbpsRequestProperty {
Max = 123,
Min = 123
},
BurstablePerformance = "burstablePerformance",
CpuManufacturers = new [] { "cpuManufacturers" },
ExcludedInstanceTypes = new [] { "excludedInstanceTypes" },
InstanceGenerations = new [] { "instanceGenerations" },
LocalStorage = "localStorage",
LocalStorageTypes = new [] { "localStorageTypes" },
MemoryGiBPerVCpu = new MemoryGiBPerVCpuRequestProperty {
Max = 123,
Min = 123
},
MemoryMiB = new MemoryMiBRequestProperty {
Max = 123,
Min = 123
},
NetworkBandwidthGbps = new NetworkBandwidthGbpsRequestProperty {
Max = 123,
Min = 123
},
NetworkInterfaceCount = new NetworkInterfaceCountRequestProperty {
Max = 123,
Min = 123
},
OnDemandMaxPricePercentageOverLowestPrice = 123,
RequireHibernateSupport = false,
SpotMaxPricePercentageOverLowestPrice = 123,
TotalLocalStorageGb = new TotalLocalStorageGBRequestProperty {
Max = 123,
Min = 123
},
VCpuCount = new VCpuCountRangeRequestProperty {
Max = 123,
Min = 123
}
},
InstanceType = "instanceType",
KernelId = "kernelId",
KeyName = "keyName",
Monitoring = new SpotFleetMonitoringProperty {
Enabled = false
},
NetworkInterfaces = new [] { new InstanceNetworkInterfaceSpecificationProperty {
AssociatePublicIpAddress = false,
DeleteOnTermination = false,
Description = "description",
DeviceIndex = 123,
Groups = new [] { "groups" },
Ipv6AddressCount = 123,
Ipv6Addresses = new [] { new InstanceIpv6AddressProperty {
Ipv6Address = "ipv6Address"
} },
NetworkInterfaceId = "networkInterfaceId",
PrivateIpAddresses = new [] { new PrivateIpAddressSpecificationProperty {
PrivateIpAddress = "privateIpAddress",
// the properties below are optional
Primary = false
} },
SecondaryPrivateIpAddressCount = 123,
SubnetId = "subnetId"
} },
Placement = new SpotPlacementProperty {
AvailabilityZone = "availabilityZone",
GroupName = "groupName",
Tenancy = "tenancy"
},
RamdiskId = "ramdiskId",
SecurityGroups = new [] { new GroupIdentifierProperty {
GroupId = "groupId"
} },
SpotPrice = "spotPrice",
SubnetId = "subnetId",
TagSpecifications = new [] { new SpotFleetTagSpecificationProperty {
ResourceType = "resourceType",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
} },
UserData = "userData",
WeightedCapacity = 123
} },
LaunchTemplateConfigs = new [] { new LaunchTemplateConfigProperty {
LaunchTemplateSpecification = new FleetLaunchTemplateSpecificationProperty {
Version = "version",
// the properties below are optional
LaunchTemplateId = "launchTemplateId",
LaunchTemplateName = "launchTemplateName"
},
Overrides = new [] { new LaunchTemplateOverridesProperty {
AvailabilityZone = "availabilityZone",
InstanceRequirements = new InstanceRequirementsRequestProperty {
AcceleratorCount = new AcceleratorCountRequestProperty {
Max = 123,
Min = 123
},
AcceleratorManufacturers = new [] { "acceleratorManufacturers" },
AcceleratorNames = new [] { "acceleratorNames" },
AcceleratorTotalMemoryMiB = new AcceleratorTotalMemoryMiBRequestProperty {
Max = 123,
Min = 123
},
AcceleratorTypes = new [] { "acceleratorTypes" },
AllowedInstanceTypes = new [] { "allowedInstanceTypes" },
BareMetal = "bareMetal",
BaselineEbsBandwidthMbps = new BaselineEbsBandwidthMbpsRequestProperty {
Max = 123,
Min = 123
},
BurstablePerformance = "burstablePerformance",
CpuManufacturers = new [] { "cpuManufacturers" },
ExcludedInstanceTypes = new [] { "excludedInstanceTypes" },
InstanceGenerations = new [] { "instanceGenerations" },
LocalStorage = "localStorage",
LocalStorageTypes = new [] { "localStorageTypes" },
MemoryGiBPerVCpu = new MemoryGiBPerVCpuRequestProperty {
Max = 123,
Min = 123
},
MemoryMiB = new MemoryMiBRequestProperty {
Max = 123,
Min = 123
},
NetworkBandwidthGbps = new NetworkBandwidthGbpsRequestProperty {
Max = 123,
Min = 123
},
NetworkInterfaceCount = new NetworkInterfaceCountRequestProperty {
Max = 123,
Min = 123
},
OnDemandMaxPricePercentageOverLowestPrice = 123,
RequireHibernateSupport = false,
SpotMaxPricePercentageOverLowestPrice = 123,
TotalLocalStorageGb = new TotalLocalStorageGBRequestProperty {
Max = 123,
Min = 123
},
VCpuCount = new VCpuCountRangeRequestProperty {
Max = 123,
Min = 123
}
},
InstanceType = "instanceType",
Priority = 123,
SpotPrice = "spotPrice",
SubnetId = "subnetId",
WeightedCapacity = 123
} }
} },
LoadBalancersConfig = new LoadBalancersConfigProperty {
ClassicLoadBalancersConfig = new ClassicLoadBalancersConfigProperty {
ClassicLoadBalancers = new [] { new ClassicLoadBalancerProperty {
Name = "name"
} }
},
TargetGroupsConfig = new TargetGroupsConfigProperty {
TargetGroups = new [] { new TargetGroupProperty {
Arn = "arn"
} }
}
},
OnDemandAllocationStrategy = "onDemandAllocationStrategy",
OnDemandMaxTotalPrice = "onDemandMaxTotalPrice",
OnDemandTargetCapacity = 123,
ReplaceUnhealthyInstances = false,
SpotMaintenanceStrategies = new SpotMaintenanceStrategiesProperty {
CapacityRebalance = new SpotCapacityRebalanceProperty {
ReplacementStrategy = "replacementStrategy",
TerminationDelay = 123
}
},
SpotMaxTotalPrice = "spotMaxTotalPrice",
SpotPrice = "spotPrice",
TagSpecifications = new [] { new SpotFleetTagSpecificationProperty {
ResourceType = "resourceType",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
} },
TargetCapacityUnitType = "targetCapacityUnitType",
TerminateInstancesWithExpiration = false,
Type = "type",
ValidFrom = "validFrom",
ValidUntil = "validUntil"
}
});
Synopsis
Constructors
CfnSpotFleet(Construct, String, ICfnSpotFleetProps) | Create a new |
CfnSpotFleet(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnSpotFleet(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AttrId | The ID of the Spot Fleet. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
SpotFleetRequestConfigData | Describes the configuration of a Spot Fleet request. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnSpotFleet(Construct, String, ICfnSpotFleetProps)
Create a new AWS::EC2::SpotFleet
.
public CfnSpotFleet(Construct scope, string id, ICfnSpotFleetProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnSpotFleetProps
- resource properties.
CfnSpotFleet(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnSpotFleet(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnSpotFleet(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnSpotFleet(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AttrId
The ID of the Spot Fleet.
public virtual string AttrId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Id
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
SpotFleetRequestConfigData
Describes the configuration of a Spot Fleet request.
public virtual object SpotFleetRequestConfigData { get; set; }
Property Value
System.Object
Remarks
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
- tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>