Amazon Web Services (AWS) Spot Fleets are collections of AWS spot instances, virtual servers from Amazon’s pool of spare capacity, offered at discounts of up to 90%. Spot instances need to be carefully managed, because they are terminated by Amazon at short notice when the market price goes about your bidding price.
Applications can make requests for Spot Fleets via the Spot Fleet application programming interface (API) or the command line interface (CLI). Because spot instances pricing often changes, EC2 constantly attempts to balance the capacity according to predefined values.
To request a Spot Fleet, you need to define a maximum price per instance hour and the desired target capacity. You are also asked to input launch specifications, defining instance types, number of required instances, and choosing availability zones.
When AWS needs to draw from the spare EC2 capacity to service customers who purchased reserved instances, savings plans or on-demand instances, they will terminate the spot instances and launch replacement instances.
When fulfilling a Spot Fleet request, AWS Spot Fleets automatically chooses the lowest-priced instances. Once Spot Fleets are enabled, the system keeps automatically managing all provisioned instance collections.
This is part of our series of articles about AWS Auto Scaling.
In this article, you will learn:
The basic problem with spot instances is that they can be terminated at short notice. This can be problematic for many types of applications, in particular mission critical applications. The application must be able to withstand the failure of any component running on a spot instance, smoothly moving that component to another spot instance or an on-demand instance.
Another challenge is that spot instance availability is very volatile. If the organization specifies one instance type and availability zone for its spot instances, there is a high risk that specific type of spot instance will not remain available as long as needed. However, by mixing instance types and offering several possible availability zones, there is a bigger chance of maintaining spot instance availability.
The idea behind Spot Fleet is to allow Amazon users to:
Spot Fleets also allows developers to specify scripts that should run in the event of instance termination. Previously, this would be done by a controller application, which represents a single point of failure. Now, developers can hand over management of spot instance termination to an Amazon service.
To create a Spot Fleet, you need to issue a Spot Fleet request, specifying:
There are two types of Spot Fleet requests:
Before making a Spot Fleet request, you should carefully consider which instance types will meet your application requirements, and what portion of the fleet should be on-demand instances, to ensure that in case spot instances are terminated, at least some of your instances will remain active.
Auto scaling lets you automatically increase or decrease a Spot Fleet's target capacity based on current demand. Spot Fleet can launch additional instances (scale out) or terminate instances (scale in) within a specified range, based on one of several scaling strategies.
Spot Fleet supports the following types of auto scaling:
A few important points about how Spot Fleet auto scaling works:
AWS Spot Fleet is a major improvement over previous methods of managing spot instances, but it is still lacking.
Here are key features related to spot instance management which Spot Fleet does not provide.
Spot by NetApp allows you to reliably run even mission-critical and production workloads on EC2 spot instances. With predictive rebalancing algorithms, spot instance interruptions are detected up to an hour in advance with proactive replacement of the at-risk instance(s). In the event that there are no available spot instances, fallback to on-demand instances will occur, thereby guaranteeing workload continuity. If there are available, unused Savings Plans or RIs, Spot by NetApp will leverage those before spinning up new spot instances to ensure maximum cost-efficiency.
Learn more about using spot instances for both non-containerized workloads as well as for containerized and Kubernetes workloads.
Complete access
for up to 20 instances