Just like renting or leasing a house, when you pay for servers from AWS, there are many, many different options. The plethora of options is so vast that it can be a little overwhelming staring at them. I’m hoping to cover the pricing options in a way that is useful. With the options, you get exactly the same server, but you pay a different price because of the different commitment level from either you or from AWS.
The main options are:
|On-Demand||0%||There’s no commitment from you. You pay the most with this option.|
|Reserved||40%-60%||1-year or 3-year commitment from you. You save money from that commitment.|
|Spot||60%-90%||Ridiculously inexpensive because there’s no commitment from the AWS side.|
With on-demand, you pretty much can get a server at any time and there’s no commitment from you. At times of extremely high demand, you might not be able to get a server. It rarely happens though. For example, it can happen during AZ outage when customers might start flood requests to an AZ because their current AZ is down. Even in these rare times when an AZ is down, I’ve been able to get instances though. That’s how rare it is not to get an on-demand instance. Once you get the on-demand instance you keep it until you terminate it. In this pricing model, you pay the most because you can leave at any time.
With reserved instances, you get the same instance hardware, but you pay less. You make some form of commitment at the beginning, and then you get to pay for the instance at a discounted rate. I’ll use made-up round numbers as an example to explain the concept:
- On-demand rate - $100/mo.
- Up-front payment - $500/mo
- Discount reserved rate - $10/mo.
The total cost for on-demand after 1 year would be $1,200. The total cost for reserved after a year would be $500 + $120 = $620. After a year, You save $580. In this case, your discount would be 48% 🎉
Within reserved pricing, there are so many details it can make even an experienced accountant run for the hills 😱
- There are 1-year or 3-year terms. Of course, you save even more money the longer you commit.
- You can save more or less money depending on how much your upfront down payment is. There are 3 options: 1) All upfront 2) Partial upfront 3) No upfront
- There’s even scheduled reserved instances. This is where you get a different price depending on literally the day of the week you reserve the instance for. The idea is that you can save money with instances on days where there is less demand, say weekends.
- There are other details on reserved instances to keep track of. You reserve instances for specific instance types, in specific AZs, and regions. Under certain conditions, you can modify the reservation and change the instance type.
- If you reserved the wrong instance type or no longer need it, you can also resell the reservation in the marketplace. Though you usually won’t get a back nearly as much as if you had just paid on-demand in the first place 🤦🏻♂️
How much can you save with reserved instances?
With a 1-year term on average 40%. With a 3-year term on average 60%. I find it hard to commit to 3 years with servers nowadays. New instance types come out all the time and are not only faster but also cheaper. A commitment of 1 year is not too long and can be an excellent way to save money on your AWS bill. So I would say that for reserved instances, you should plan your thinking around 40%, which is fantastic.
Now for the most exciting pricing option: spot. With spot instances, the commitment concept gets reversed. Instead the of lack of a commitment benefiting you, it applies the other way to AWS. With on-demand, you do not commit to AWS. With spot, AWS does not commit to you. With this kicker model, the pricing becomes extremely attractive. We’re talking about a 60% to 90% savings. That’s not just me being overly optimistic. I’ve seen these savings realized repeatedly.
The way spot works is that you bid for your instance, like an eBay auction. If the spot market price is below your bid price then get the instance at the market price. I’ll repeat that. You pay the lower market price, not the price you bid on. An example to help explain:
- On-Demand price: $1/hr
- The market spot price: $0.2/hr
- Your bid price: $0.5/hr
- What you pay: $0.2/hr
This is a fascinating model and is favorable to saving you even more money. I think it’s a genius move by AWS. Imagine if eBay ran this way. You win an item on eBay and you pay the second highest bid that lost. Awesome for you right?
With spot instances, the biggest disadvantage is that AWS can terminate your instance at any time. Remember there’s no commitment from AWS to give you the instance. This is not so awesome, right? Because of this and the generous pricing model, people sometimes just bid at the on-demand price to increase their chances of getting the spot instances. Though there are many other ways to increase your chances of getting spot instances. On average, spot instances get interrupted less than 5% of the time. Here’s a screenshot of the number from the AWS Spot Instance Advisor site.
Also, there are several ways to build your system so that you can take advantage of spot instances and switch over to on-demand as required. I provide some more thoughts about this and a link to the architecture in a later section.
EC2 On-Demand vs Reserved vs Spot Comparison Table
Let’s put down some hard numbers to get a sense of how much money you can save with the different pricing models. For reserved, we’ll use the 40% savings since the 1-year term is a smaller commitment. For spot, we’ll use 80% since that is the typical savings. I know, I still shake my head in disbelief over the large spot percentage. Here’s an example table with the expected bill and savings.
|AWS Bill / On-Demand||Reserved (40% savings)||Spot (80% savings)|
|$5,000/mo||$3,000/mo ($2,000/mo)||$1,000/mo ($4,000/mo)|
|$20,000/mo||$12,000/mo ($8,000/mo)||$4,000/mo ($16,000/mo)|
|$50,000/mo||$30,000/mo ($20,000/mo)||$10,000/mo ($40,000/mo)|
|$200,000/mo||$120,000/mo ($80,000/mo)||$40,000/mo ($160,000/mo)|
See your estimated savings. Input your own number:
|AWS Bill / On-Demand||Reserved (40% savings)||Spot (80% savings)|
|$10,000/mo||$6,000/mo ($4,000/mo)||$2,000/mo ($8,000/mo)|
|$120,000/yr||$72,000/yr ($48,000/yr)||$24,000/yr ($96,000/yr)|
As crazy as spot instances might sound, it’s a blessing in disguise. I’ll explain.
When I discovered spot instances, I experienced a similar realization moment as when I ran into AutoScaling. I thought to myself many years ago:
“Well, that sounds dandy, but this sucks. I now need to worry about making sure that my servers can be replaced at any time and are always highly available due to AutoScaling up and down.”
Let me repeat and paraphrase that:
“We must worry about making servers highly available.”
But shouldn’t we strive to make the servers highly available regardless? The answer is, of course, we should. In the moment of trying to ship features or getting other tasks done, we cheat. We all do it. It’s an understandable situation.
With spot instances, I had a similar reaction. I thought:
“Wait, so AWS can take away the instance at any time? That’s insane. My job is hard enough, that just makes it even harder.”
As it turns out, like AutoScaling, the more I learned about spot instances, the more I came to realize that it’s a blessing in disguise. It encourages a certain mentality. It ensures you build an infrastructure architecture that follows the best practice of high availability. Not to mention, the additional reward in doing so is huge: 60% to 90% savings with virtually no commitment on your side.
You see a critical difference between on-demand vs. reserved instances is that you must commit on your side to running the instance for 1 to 3 years. With reserved instances, you must also consider all the devilish pricing details and gotchas that were mentioned earlier. With spot, you get more of savings than even the 3-year reserved instance commitment. An additional benefit is that there is still no commitment from you at all. You can stop using spot instances at any time.
How do you build a highly available architecture that takes advantage of spot instances for 60%-90% savings on your AWS bill?
There are many ways to build highly available infrastructure architectures to take advantage of spot instances. The hugely successful setup I’ve found is to have an AutoScaling on-demand fleet that runs alongside the spot fleet and is switched over to as needed. I discuss spot fleet instances more here: How Spot Fleet Instances vs Spot Instances Work.
This architecture saves 60% to 90% of your AWS bill, which can add up to a lot to the bottom line. At the same time, it follows best practices to ensure high availability. The architecture is available here: Spot Instance Highly Available Architecture.
Note, there is also the dedicated instances. With dedicated instances, the instances run on your own dedicated section of AWS hardware, not a virtual machine. As such, it is much more expensive, so I’m not covering them in this post aside from this quick mention.
That covers the pricing modeling differences between EC2 On-Demand, Reserved, and Spot. Hopefully, you found that informative and helpful. 😁