5 Newish Improvements to AWS Spot Instances
Tags: aws, kubernetes, machinelearning
Published: 2020-01-28 19:42:45

If you use EC2, you’re probably already aware of the existence of [Spot instances](https://aws.amazon.com/ec2/spot/getting-started/). Spot has existed for years, but like many AWS services, has dramatically changed over time.  It’s Amazon’s way of keeping their servers busy by selling spare computing capacity at a 50% to 90% discount - then reclaiming that computing capacity when On-Demand customers need it again.

While the computing environment for Spot has always been the exact same as On-Demand, Amazon has been rolling out more and more integrations of Spot within other AWS services. Here are five ways Amazon has made it easier for your organization to take advantage of the cost savings of Spot instances:

### 1. [EC2 Auto Scaling and EC2 Fleet features a new allocation strategy](https://aws.amazon.com/blogs/compute/introducing-the-capacity-optimized-allocation-strategy-for-amazon-ec2-spot-instances/) that can automatically mix in available Spot instances. 

First, you configure the pools of Spot instances capable of running your workloads, then select the “lowest price” allocation option. This will spin up capacity only using the lowest-priced [Spot instances](https://gennovacap.com/cloud/aws-spot-instances/) among your chosen pools. EC2 Fleet also has a “diversified” strategy that will evenly spin up Spot instances among your chosen pools.

### 2. Batch workloads were always a natural pairing for Spot instances, but it’s even easier now with [an option within AWS Batch](https://www.youtube.com/watch?v=qPU9FzuAKIw). 

If your job gets interrupted, Batch can automatically resubmit it onto a different Spot or On-Demand instance. With the cheaper compute provided by Spot, organizations are able to dramatically increase their processing power to accomplish more jobs, more quickly. To learn more, take a listen to the [AWS Podcast discussion on Spot instances with Batch here](https://aws.amazon.com/podcasts/339-batch-workloads-on-amazon-ec2-spot-instances/).

### 3. The computing capacity demanded by Machine Learning is going to continue to grow exponentially. This can be cost prohibitive for many businesses, but recently [Amazon added Managed Spot Training to SageMaker](https://hackernoon.com/grow-your-ai-while-cutting-machine-learning-costs-sagemaker-will-now-manage-spot-instances-for-you-fau3222). 

Now SageMaker can automatically checkpoint data when Spot instances are interrupted - and restart the workloads when the capacity becomes available again. The AWS Blog recently summarized how one [AI company had saved 70% on ML training runs by taking advantage of the Managed Spot Training](https://aws.amazon.com/blogs/machine-learning/cinnamon-ai-saves-70-on-ml-model-training-costs-with-amazon-sagemaker-managed-spot-training/?nc1=b_rp).

### 4. At re:Invent 2019, Amazon announced Fargate Spot for both [Elastic Container Services](https://aws.amazon.com/blogs/aws/aws-fargate-spot-now-generally-available/) and [Elastic Kubernetes Services](https://aws.amazon.com/blogs/aws/amazon-eks-on-aws-fargate-now-generally-available/?nc1=b_rp). 

Fargate manages the provisioning and scaling of resources needed to run your containers - and now can do so with Spot to save up to 70%. Some workloads just aren’t fault-tolerant, but if they can restart after an interruption, then Fargate Spot is a way to significantly [lower your AWS bill](https://gennovacap.com/cloud/amazon-aws-billing/).

{% youtube ZA6uVub2H4Q %}

###5. Amazon has made several changes over the last couple years to make it easier to estimate the costs and service interruptions of Spot:

   • [AWS recently announced launch events for Spot instances will now be available through the Amazon CloudWatch Events CLI](https://aws.amazon.com/about-aws/whats-new/2019/12/amazon-ec2-spot-now-provides-instance-launch-notifications-via-amazon-cloudwatch-events/). This will enable customers to better control when certain workflows are launched when a Spot instance becomes available

   • Amazon [no longer relies on a complicated bidding process to determine Spot pricing](https://aws.amazon.com/blogs/compute/new-amazon-ec2-spot-pricing/). Now your organization either pays the prevailing Spot price if the spare capacity is available - or it doesn’t. This has made the pricing significantly more stable and instead of bidding against other potential AWS customers, you simply tell AWS the maximum amount your organization is willing to pay.

   • Engineers can easily research the price savings and interruption averages of every available instance type in every Availability Zone using the [Spot Instance Advisor](https://aws.amazon.com/ec2/spot/instance-advisor/). For most instance types, it is the customer choosing to terminate Spot instances - not AWS - for more than 95% of the time. But for other instance types it can be AWS interrupting service more than 20% of the time, making them potentially unsuitable for certain workloads.

Spot instances may not be the best option for all workloads or business scenarios. But when you need to scale up your computing power at an affordable price, retooling your architecture to rely on Spot could be worth it. Looking to learn more about Spot instances? Here are a few great resources:

   • Western Digital used [AWS Batch with 40,000 Spot instances to complete 2.5 million HPC tasks in just 8 hours](https://aws.amazon.com/blogs/aws/western-digital-hdd-simulation-at-cloud-scale-2-5-million-hpc-tasks-40k-ec2-spot-instances/).

   • [Amiram Shachar’s podcast on SpotInst at Software Engineering Daily](https://softwareengineeringdaily.com/2019/01/18/spot-instances-with-amiram-shachar/).


{% youtube 1GMB6Pjxn2c %}