The cloud might not be expensive to start on, but once an application grows in complexity and user base, it can quickly become expensive. Sometimes that means a popular app isn’t even profitable, so companies will look for ways to cut costs without lowering computing power.

That’s why many businesses will start using EC2 Spot instances – to save money – instead of relying on AWS Reserved and On-Demand instances to power their application. Spot Instances are much less expensive than On-Demand instances, sometimes up to 90% cheaper. You can see how much cheaper a certain type of instance in a certain Availability Zone can be by using the Amazon Spot Instance Advisor.

A huge cloud provider like Amazon has to be able to handle the wide variety of demand placed on its servers by customers – that’s why it builds large amounts of “excess” computing capacity. That excess capacity is sold as discounted Spot Instances. They are no different in power or even located on a different physical server than Reserved or On-Demand instances. AWS Spot Instances help keep Amazon’s servers busy, servers that would otherwise be idle if their computing capacity wasn’t sold at a lower price.

Of course, Amazon can’t just give away less expensive computing capacity: no one would ever pay full price for On-Demand and Reserved instances again! So they occasionally kick customers off of Spot Instances, to reclaim the computing power when the demand for Reserved and On-Demand instances are high. Amazon can kick you off Spot Instances with just two minute warnings. In other words, your application needs to be engineered to manage disruptions of certain instances and replaced with others, depending on your business needs.

Disruptions in service are managed using Spot Fleet. So while a business can save thousands of dollars in cloud costs every month, they first need to invest in AWS DevOps engineers. They can diversify the instances the application runs on to prevent it from crashing. Then when demand on AWS lowers, the ideal mix of cheap Spot Instances can automatically begin powering your application again.

That’s one of the reasons the cheapest Spot Instances are often used for non-critical or fault-tolerant work. Every potential Spot Instance customer instructs Amazon on the maximum amount they’re willing to spend before they no longer wish to use that Instance. If you bid too low, the likelihood of being outbid by a competitor increases – but if you bid too high, you could end up not saving much money and still have to deal with service disruptions. Again, that’s why it’s important for the application’s developers to work closely with DevOps engineers that have a deep understanding of AWS and how to balance cost savings with service needs and what type of instances to deploy.

Reserved Instances are commitments to Amazon that a business will pay for a certain amount and type of computing capacity for 1, 2, 3 or more years. In exchange for the commitment, Amazon offers a significant cost savings over On-Demand Instances – but the business is paying for the server capacity whether they use it or not. In the real world, the demands on applications can grow and shrink frequently, and when they shrink you may not end up saving much money with Reserved Instances. While they’re more expensive and require a commitment, if the application always requires a minimum amount of computing capacity without service disruptions, they may be good compliment to Spot Instances.

On-Demand Instances are never interrupted and require no commitment – but they’re also the most expensive version of whatever EC2 server the application requires. There may be so much disruption or higher bidding for Spot Instances that the application may need to run on On-Demand Instances until there is enough excess capacity to run on Spot Instances again.

One of the best applications of Spot Instances are deploying Kubernetes or other containerized workloads. It doesn’t require the newest, more advanced, and therefore less common and more expensive computing servers at Amazon’s data centers. Kubernetes can run just as well on older, more common servers – exactly the type of servers Amazon often has the most excess capacity of.

Remember, AWS’s business model requires it to spend billions of dollars investing in its data centers and building insane amounts of computing capacity. They want those servers kept as busy as possible: that’s how they make money on their investment and build even more data centers. Spot Instances are how they recoup their money on idle servers – they offer a steep discount – a discount smart application developers are taking advantage of.

So whether the application relies on C instances or M instances or Z instances, it doesn’t matter: there will be Spot Instances available that are cheaper than their On-Demand and Reserved counterparts. But they may not always be available – and the cost may fluctuate depending on the maximum bid set by you and AWS’s other cloud customers.