What is the Difference Between Spot Fleet vs Spot Instances
One of the biggest game-changers to spot instances are spot fleets. I mentioned how you could save 50%-90% when you take advantage of spot instance pricing in: How Does Spot Pricing Work? Spot fleets is where things get even more interesting. With a normal spot instance request, you place a bid for a specific instance type in one specific AZ and hope you get it. With spot fleets, you can request a variety of different instance types that meet your requirements. Additionally, you can spread your spot fleet bet across multiple AZs to increase the likelihood of getting your instance fulfilled. It’s like playing rollette and being able to bet a single chip on multiple numbers. Insanely cool! The method dramatically increases the chances of you getting instances available at your spot bid price. Like I said, game-changer.
Honestly, most of the time, it makes little difference which exact server you use if it has enough of the right resources. Usually, that resource is CPU and RAM. For example, both the
m5.xlarge instances have
16GB of RAM and
4CPUs. So it makes sense to request for both instance types with a Spot Fleet request and let Spot Fleet give you the lowest priced option. Generally, if the server has enough RAM and CPU, then your application should perform just as well.
Now there are some HPC, High Performance Computing, applications where the type of instances matters more. Here are a few examples: Genomics Processing, DNA Sequencing, Media Encoding/Transcoding, Computation Chemistry, Animation and Visual Effects Rendering, Financial Trading Analytics, Image Processing, Web Analytics, and Business Intelligence. In these cases, you scope the spot fleet request to the instance type optimized for that resource.
For example, let’s say your Genomics Processing step has a high IO requirement. In that case, use I2 and I3 instance types for the request. There are still plenty of options within that instance family. HPC usually requires massive amounts of server resources and a large server farm. So it is even more important to use a variety of instances and lower your cost with spot.
Spot Fleet Weighting
With spot fleets, you can also apply a custom weighting to each instance type. Weighting tells the spot fleet request what total capacity we care about. As a simple example, say we would like a total capacity of 10GB of RAM, and we select two instance types, one that has 2GB and one that has 4GB of RAM.
If we assign a weight to each instance that is equal to the amount of RAM, then we can tell the spot fleet to give us 10 units of capacity. Spot fleet then uses the weighting information to provision 10 units. It can be five 2GB instances or two 4GB and one 2GB instance. It does not matter. We still get a total of 10 units or 10GB of capacity.
Spot fleets work conservatively and will round up and slightly over provision if the instance types happen not perfectly to meet 10 units. For example, three 4GB instances result in 12 units. A more detailed explanation of spot fleet weighting is covered in this article: Spot Fleet Weighting and Pricing Explained.
Highly Available Architecture with Spot Fleets
Spot Fleets make it much easier to design a Highly Available fault-tolerant architecture with spot instances. With spot fleets, you can request a variety of servers for the spot fleet request. Additionally, you can have an on-demand AutoScaling cluster to serve supplemental capacity. Learn more about Spot Compute here: BoltOps Learn videos on Spot
Spot fleets are the best thing since sliced bread. While it is possible to write the spot fleet logic yourself, there’s little point, AWS has once again done the hard work. It makes our lives much easier. We just have to learn how to leverage the spot fleet request fully. Doing so can save you 50%-90% of your AWS bill, no joke.
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.