The argument for AWS Spot Instances
Explaining Spot Instances
- Spot Instances are a type of Amazon Elastic Compute Cloud (EC2) instance that utilizes spare capacity within the AWS cloud.
- These instances are available at significantly reduced rates compared to On-Demand prices.
- AWS offers this excess capacity to users, allowing them to leverage it for their workloads.
Why use Spot
Key differences between Spot Instances and On-Demand Instances
How does spot work?
Spot functions with a very simple principle and AWS has stated how it works very clearly. To use Spot Instances, you create a Spot Instance request that includes the desired number of instances, the instance type, and the Availability Zone. If capacity is available, Amazon EC2 fulfills your request immediately. Otherwise, Amazon EC2 waits until your request can be fulfilled or until you cancel the request.
The following illustration shows how Spot Instance requests work.
Notice that the request type (one-time or persistent) determines whether the request is opened again when Amazon EC2 interrupts a Spot Instance or if you stop a Spot Instance. If the request is persistent, the request is opened again after your Spot Instance is interrupted. If you have a persistent request and stop your Spot Instance, the request will only reopen once you restart your Spot Instance. Essentially, you place a bid, and if it’s accepted, you receive the resource. If it’s rejected, you continue to wait until you decide to cancel the request.
SpotQuakes and the downside of using AWS Spot Instances
A few years back we touched on Spot Quakes, our affectionate name for the event in which you lose all your spot instances in one go; things get a little bumpy. When a spot instance is about to be taken away you receive an event, this event is your 2-minute warning; shutdown and evacuate. This inherent characteristic means Spot Instances are better suited to workloads that can handle interruptions gracefully.
In addition, the following aspects of Spot instance should be observed:
- Price Volatility
- Spot Instance prices fluctuate based on supply and demand. While they are generally much lower than On-Demand prices, sudden spikes can occur.
- If the price increases significantly, your Spot Instances may be terminated automatically. It’s essential to monitor prices and set appropriate bid prices.
- Bid Strategy
- When launching Spot Instances, you need to specify a bid price. If your bid is below the current market price, your instances may be terminated.
- Choosing the right bid strategy (e.g., bidding at the On-Demand price or slightly above) is crucial to avoid frequent interruptions.
- Workload Compatibility
-
- Not all workloads are suitable for Spot Instances. Real-time applications, databases, and mission-critical services may not tolerate interruptions.
- Analyze your workload’s characteristics and determine if it aligns with Spot Instance behavior.
- Capacity Availability
- While Spot Instances are usually available, there might be times when capacity is scarce due to high demand.
- If your workload relies heavily on Spot Instances, consider diversifying across multiple instance types or regions.
- Stateful Workloads
- Stateful applications (those that maintain internal state or data) may face challenges with Spot Instances.
- If an instance is terminated, any unsaved data could be lost. Ensure your application handles state appropriately.
What’s the best alternative?
If you’re wondering what else can be done then you are not alone. AWS, and specifically EKS can create a massive amount of hard to remove waste and Sysdig and Datadog have the data to prove it, (check out the 2023 report).
Our approach leverages AWS Bare Metal and virtualization to provide a new type of computing engine inside your AWS account. Our latest product innovation, Elastic Machine Pool removes the need to use spot instances, automates infrastructure and removes the need to constantly change resource requests.
- Top 5 considerations for migrating off VMware - September 20, 2024
- FinOps: Applying Earned Value Management to maximize ROI - June 18, 2024
- Top 6 FinOps KPIs for EKS - June 17, 2024