Reducing cloud costs with spot instances: Is it the right choice for you and how to get started?

Rastko Vasiljevic

07.10.2024

Your monthly cloud spending has arrived higher than you expected; despite efforts to optimize costs, savings have been lacking. Why?


The analysis shows the frequency of situations such as:

  • Your dev team often spins up new virtual machines for short-term use and then shuts them down.
  • You use certain VMs heavily for a few hours a day and then sit idle until the next cycle, usually for data analyst batch jobs.
  • Demands for large GPU and CPU resources to serve large-scale calculations for several weeks, then pause until the next data set.

Such scenarios show that the long-term commitment and limited flexibility of reserved instances is not an optimal choice and does not bring the desired savings. As a more dynamic and economical solution, spot instances are imposed.

What are spot instances?

Cloud providers such as AWS, Microsoft Azure and Google Cloud maintain redundant computing resources to ensure almost 100% availability, even in the most challenging situations. These excess resources often go unused, presenting an opportunity for additional revenue to providers. Spot instances (AWS), spot VMs (Azure) or preemptible instances (Google Cloud) are VMs that use these redundant resources.

These instances are offered at significantly discounted prices — up to 90% off standard on-demand pricing. The downside is that the provider can terminate those instances with minimal notice when they need those resources for other users. This makes spot instances ideal for workloads that are not critical and can tolerate interruptions.

When to use spot instances?

Spot instances are the most efficient solution for tasks that are not “time sensitive” and can be interrupted without consequences. These instances are available whenever excess resources are free, which varies depending on demand within the data center or region. For example, availability may increase during nights, weekends or holidays, depending on the total usage in that zone.

To increase the chances of successfully using a spot instance, consider using less popular types or instances of older generations, as they are less in demand.

Spot instances are ideal for:

  • Batch jobs: These tasks often run outside of the busiest hours of the day and can tolerate interruptions and delays, making them ideal candidates for such specific availability of computing resources.
  • Stateless applications: Applications such as image processing services can use spot instances for scaling. A hybrid approach with on-demand instances provides basic availability, while spot instances cover the additional load.
  • Testing and development: Environments where VMs can be shut down without affecting ongoing operation are ideal for using a spot instance.
  • Big Data and Analytics: Jobs that run periodically or on large data sets can benefit from the savings provided by spot instances.
  • High-Performance Computing (HPC): For tasks that require intensive computing but not continuous operation, spot instances offer significant cost savings.

Recommendations for optimizing the use of spot instances

  • Assess your workload: Identify which of your applications or tasks are suitable for spot instances. If you are developing new applications, consider designing them to use these instances to achieve cost savings.
  • Study the provider’s guidelines: Each cloud provider offers detailed documentation and best practices. AWS advises using a variety of instance types, especially older generations, which have more stable pricing. Google Cloud suggests using non-standard machine types, as they often have more extra resources available.
  • Combine spot instances and on-demand resources: To ensure both availability and cost efficiency, consider a hybrid approach. Use on-demand instances for guaranteed functionality, while spot instances cover additional non-critical workloads.

By using Spot Instance strategically, you can significantly reduce cloud costs while maintaining the flexibility and performance your business demands.

Sign up for the newsletter

If you want to receive relevant news and new blog content, leave your contact.


    Kubernetes Resource Limits: Handling CPU and Memory Restraints with Two-Edged Swords  

    Kubernetes CPU and memory limits are essential for managing resources, but setting them too low can lead to throttling…

    Meet our colleagues from HC Center in Slovenia 

    Mainstream’s partnership with HC Center is an exciting step toward combining our strengths in cloud technology and IT services to help businesses in Slovenia thrive in their digital transformation journey.

    How to choose the optimal cloud for the needs of your startup?

    Everything startups must consider when choosing technologies and cloud services to optimize performance and reduce costs.

    WAIT!

    Don’t leave without the latest tech & business insights.

    Receive Monthly Updates from Industry Experts

    *No spam - just quality content