Understanding EC2 Pricing Models
On-demand, reserved instances, savings plans, spot instances, and dedicated hosts. With so many pricing options to choose from, how do you pick the right one for your EC2 needs? QloudX is here to help! 😇
First things first: both spot instances & dedicated hosts are for certain specialized needs so let’s keep them apart. Spot is for workloads that can tolerate interruptions. Dedicated is for when you need an entire rack just for yourself, probably for licensing or compliance reasons.
Most of the EC2 usage out there is for VMs running non-interruptible workloads (like web servers) on shared-tenancy hardware. Therefore, this article will focus on only the first three pricing models: on-demand, reserved instances, and savings plans.
Example Architecture
Let us take an example architecture and apply the pricing models to it. Along the way, we will learn about the nuances of every model and get a feel for when to use which one.
Say you have a simple webapp architecture comprised of a web server, an app server & a database server. The instance types of each of these are as follows:
Web Server | m5.xlarge |
App Server | c5.xlarge |
Database Server | r5.xlarge |
Let us begin with the simplest pricing model: on-demand.
Note: All prices in this article are in USD per month and for Linux EC2 instances in US East 1: N. Virginia running 730 hours per month.
On-Demand
Unlike reserved instances and savings plans, on-demand is very straightforward. There is a flat hourly charge which you add up for a month to get your total bill. In this case, it would be as shown in the table below:
Server | Type | USD per Month |
---|---|---|
Web Server | m5.xlarge | 140.16 |
App Server | c5.xlarge | 124.10 |
Database Server | r5.xlarge | 183.96 |
448.22 |
With such a simple pricing structure, why would you ever need any other pricing model? The answer is simple: just like (almost) everything else in the real world, if you buy more, you pay less! In other words, if you are willing to buy something in bulk, you would pay less than the sum of the individual pieces.
So what does that mean in EC2 terms? “Bulk” in EC2 terms means the duration of your EC2 usage. If you have long-running instances, you can save money by switching to reserved instances or savings plans instead of on-demand pricing.
That’s our first lesson: Don’t pay on-demand prices for long-running instances! “Long-running” here means at least a year, which is very commonly the case for EC2 instances hosting websites, for example.
Let us now look at what benefits we get by switching to reserved instances and/or savings plans.
Reserved Instances and Savings Plans
Before we jump into pricing our instances with these models, we need to understand how they work. Both reserved instances & savings plans come in 2 distinct flavors. Each flavor requires you to commit to using EC2 for the next 1 or 3 years, and finally, you can optionally pay for your committed term, either partly or in full.
The longer the term of your commitment and the more you pay upfront, the more discount you get.
Let us first dive deeper into reserved instances.
Reserved Instances
Reserved instances come in 2 flavors:
- Standard reserved instances
- Convertible reserved instances
Each requires a 1 or 3-year commitment & you have the option to pay upfront (partly or fully) to further increase your discounts.
Reserved instances can be purchased in the EC2 console. Reserved instances are tied to the instance type so in our example above, we would need to purchase 3 reserved instances, 1 each for m5.xlarge, c5.xlarge, and r5.xlarge.
Standard reserved instances are tied to an instance type whereas a convertible reserved instance type allows changing its instance type down the line. Reserved instances can be sold back on the reserved instance marketplace if you no longer need them.
Let’s now look at how savings plans compare to reserved instances.
Savings Plans
Savings plans are fundamentally different from reserved instances. Instead of committing to using a specific type of EC2 instance for years, you commit to using a certain dollar amount per hour of general AWS compute resources. For example, you might commit to using $10/hour of compute resources for the next year.
Savings plans come in 2 flavors:
- EC2 instance savings plans
- Compute savings plans
Each requires a 1 or 3-year commitment & you have the option to pay upfront (partly or fully) to further increase your discounts.
With EC2 instance savings plans, you commit to using a dollar amount of a certain instance family (m5, c5, r5, etc) in a region. This is much more flexible than reserved instances.
Compute savings plans only ask for an hourly commitment like $10/hour. They apply not just to EC2 but also to Fargate & Lambda regardless of region, instance family, size, and operating system.
Example Cost
Knowing all that we know now, let us get the exact cost for our example architecture:
Standard Reserved Instances | Convertible Reserved Instances | EC2 Instance Savings Plans* | Compute Savings Plans* | |
---|---|---|---|---|
Web Server m5.xlarge | 88.33 | 102.93 | 88.33 | 102.93 |
App Server c5.xlarge | 78.11 | 89.79 | 78.11 | 89.79 |
Database Server r5.xlarge | 116.07 | 133.59 | 116.07 | 133.59 |
282.51 | 326.31 | 282.51 | 326.31 |
All prices are in USD per month for 1-year no upfront payment options.
*For savings plans, an hourly commitment equal to the rate of the instance is considered. For example, EC2 instance savings plans rate for m5.xlarge in the US East 1 (N. Virginia) for a 1-year term and no upfront payment options is 0.121 USD. So an hourly commitment of $0.121/hour is used for the cost calculations in the above table.
Every instance has an on-demand rate and a savings plan rate, which is very close to, if not the same as the reserved rate. Notice how in the table above, the EC2 instance savings plans cost the same as standard reserved instances, and the compute savings plans cost the same as convertible reserved instances. This is only when the hourly commitment for savings plans is exactly the same as the rate of the instance.
Compare Pricing Models
All said and done, how do you really choose between which is right for you: standard or convertible instances, or EC2 or compute savings plans? This comparison table should help:
Standard Reserved Instances | Convertible Reserved Instances | EC2 Instance Savings Plans | Compute Savings Plans | |
---|---|---|---|---|
Fixed instance family? | 🟢 | 🟢 | 🟢 | 🔴 |
Fixed instance size? | 🟢 | 🟢 | 🔴 | 🔴 |
Fixed AZ? | 🟢 | 🟢 | 🔴 | 🔴 |
Fixed region? | 🟢 | 🟢 | 🟢 | 🔴 |
Fixed OS? | 🟢 | 🟢 | 🔴 | 🔴 |
Hourly commitment? | 🔴 | 🔴 | 🟢 | 🟢 |
Can resell? | 🟢 | 🟢 | 🔴 | 🔴 |
Conclusion
We hope this article has helped you better understand EC2 pricing models. You should now be able to use the most efficient pricing strategy in all your projects! 😊
Note that it’s possible to use reserved instances and savings plans together. In such a case, reserved instances discounts apply before savings plans.
About the Author
Harish KM is an AWS Developer at QloudX. He is passionate about creating zero-maintenance fully-serverless cloud-native solutions in AWS. With 20+ cloud & IT certifications, he is an expert in a multitude of technologies, especially serverless.