AWS::EC2::SpotFleet
- A Spot Fleet request contains the configuration information to launch a fleet of instances
- The Spot Fleet requestcan include multiplelaunch specifications
Spot Instance
- It's a type of EC2 instance that uses spare capacity availableat a significantly reduced cost compared to On-Demand Instances.
- Good for batch jobs, data analysis, image processing, distributed workloads
Pricing
- Up to 90% cheaperthan On-Demand Instances
- The pricing fluctuates based on supply and demand for capacity.
Interruption
- AWS may interrupt your Spot Instance when the capacity is no longer available or when the Spot price exceeds the price you've set as your maximum (if specified).
- Spot Instances rely on spare capacity in AWS regions. If the capacity demand increases, AWS can reclaim Spot Instanceswith atwo-minute warning
- The 2-minutes warnings is sent via EventBridge
Spot Block
- Designed not to be interrupted
- When you cancel the spot request, the associated instances are not terminated
- If a request is pesistent, it's opened again after the instance is interrupted
Properties
Type: AWS::EC2::SpotFleet
Properties:
  SpotFleetRequestConfigData:
    SpotFleetRequestConfigData
SpotFleetRequestConfigData
AllocationStrategy: String
Context: String
ExcessCapacityTerminationPolicy: String
IamFleetRole: String
InstanceInterruptionBehavior: String
InstancePoolsToUseCount: Integer
LaunchSpecifications:
  - SpotFleetLaunchSpecification
LaunchTemplateConfigs:
  - LaunchTemplateConfig
LoadBalancersConfig:
  LoadBalancersConfig
OnDemandAllocationStrategy: String
OnDemandMaxTotalPrice: String
OnDemandTargetCapacity: Integer
ReplaceUnhealthyInstances: Boolean
SpotMaintenanceStrategies:
  SpotMaintenanceStrategies
SpotMaxTotalPrice: String
SpotPrice: String
TagSpecifications:
  - SpotFleetTagSpecification
TargetCapacity: Integer
TargetCapacityUnitType: String
TerminateInstancesWithExpiration: Boolean
Type: String
ValidFrom: String
ValidUntil: String
AllocationStrategy
- lowestPrice: launches instances from the Spot Instance poolswith the lowest price
- diversified: launches instances from all the Spot Instance poolsthat you specify
- capacityOptimized: launches instances from Spot Instance poolswith optimal capacity for the number of instances that are launching
TargetCapacity
- Define numberof instances andmax cost per spot instance
- When the price is higher you get 2min grace period to stop or terminate the instance
Type
- request: once interrupted won't launch again
- maintain: once interrupted will claim again