Amazon EC2 instances are kind of like ice cubes. They can take almost any formation (configuration) you want or need them to, but some will cost more than others as a result.
Yet, when it comes to EC2 instance pricing, it’s easy for your brain to melt in confusion.
Amazon, as always, does a terrible job at explaining exactly what your options are for paying for your instances, and even what each category of instance will cost you. From Savings Plans to Dedicated Hosts, if you want to find the best savings for your setup you’ll need to trawl through countless help articles and compare sources full of technical jargon.
Well, no more!
This post will teach you everything from what to expect of your EC2 instance pricing based on your instance categories to the different payment methods that could save you money and how to judge which option is right for you.
- The 5 EC2 instance categories
- The 7 EC2 instance pricing payment options
- Which option is right for you?
- How to monitor EC2 instance pricing
Disclaimer: Amazon often updates its server types according to new technology releases. As such, prices in this article are accurate at the time of writing, being July 15th, 2022.
The 5 EC2 instance categories
First let’s briefly overview the categories of EC2 instances, as without knowing those it’s impossible to understand the ins and outs of EC2 Instance Pricing. This is because, while the pricing payment options differ in their broad strokes, the instances you specifically choose to run will still be affecting your final price.
For example, a t4g.nano instance will always cost less than a u-6tb1.112xlarge instance, no matter whether you’re paying for them on-demand or on a savings plan.
We’ll briefly overview each of the following instance categories:
- General purpose
- Compute Optimized
- Memory Optimized
- Accelerated Computing
- Storage Optimized
Note that, for the sake of simplicity, all rough prices quoted in this section are based on paying via the on-demand model. This is to maintain consistency so that you can get a rough idea of how expensive each category of instance is.
EC2’s “general purpose” instances are great all-rounders providing a balance of resources for a wide range of uses. These include running web servers, code repositories, small-to-mid-sized databases, gaming, app servers and app development.
General purpose instance types include:
- M5, M5a, M5n, M5zn
- M6a, M6g, M6i
- T2, T3, T3a, T4g
These range in on-demand pricing from $0.0042 per hour for a t4g.nano instance to $8.2944 per hour for an m6a.metal instance.
The “Compute Optimized” EC2 instances are optimized for computer-bound (CPU-bound) apps which tend to benefit more from high-performance processors. These instances are best used for things such as media and video encoding, high-performance computing, scientific modeling, crash simulations, and even computational chemistry.
Compute Optimized EC2 instance types include:
- C5, C5a, C5n
- C6a, C6g, C6gn
- C6i, C6id
These range in price from $0.034 per hour for a c6g.medium instance to $7.344 per hour for a c6a.metal instance.
Memory Optimized instances are best for workloads that process large data sets in memory but still require fast performance, and memory-intensive workloads in general. For example, you’d want to use a Memory Optimized instance if you were running high-performance or in-memory databases, or hosting an app which processes big unstructured data in real-time (eg, financial services).
Memory Optimized EC2 instance types include:
- R5, R5a, R5b, R5n
- R6g, R6gd
- R6i, R6id
- X1, X1e
- X2gd, X2idn, X2iedn, X2iezn
- High memory
Prices for these range from $0.0504 per hour for an r6g.medium instance to $54.60 per hour for a u-6tb1.112xlarge instance.
Accelerated Computing instances enable higher throughput for compute-intensive workloads via using hardware accelerators to perform certain functions more efficiently than CPUs can. This makes them ideal for machine learning, speech recognition, translation and transcription, and a wide array of graphics-intensive applications.
Accelerated Computing instance types include:
- G4ad, G4dn
- G5, G5g
- P2, P3, P4
Prices for these range from $0.228 per hour for an inf1.xlarge instance to $32.7726 per hour for a p4d.24xlarge instance.
Finally, Storage Optimized instances are pretty much what you would expect from the name. They’re designed to work with very large data sets on local storage while handling workloads that still require high, sequential read and write access to that data. This makes them ideal for massive parallel processing (MPP) data warehousing, NoSQL databases, and log or data processing applications, to name a few examples.
Storage Optimized instance types include:
- D3, D3en
- I3, I3en
Prices for these range from $0.14408 per hour for an is4gen.medium instance to $10.9824 per hour for an i4i.32xlarge instance.
The 7 EC2 instance pricing payment options
Now let’s get into the meat of the topic; the EC2 instance pricing payment options.
The important thing to remember here is that, while some options are generally cheaper than others, your price is still going to ultimately depend on which instances you’re running.
Your instance purchasing options are:
- On-Demand Instances
- Savings Plans
- Reserved Instances
- Spot Instances
- Dedicated Hosts
- Dedicated Instances
- Capacity Reservations
Paying for instances On-Demand is one of the more common practices, as this gives you a huge amount of flexibility to control your costs and resources.
On-Demand Instances let you pay by the hour for the instances you launch without any upfront costs or commitments. This means that you can freely adjust your instances on the fly without worrying about wasting money on usage that you’re not getting.
The only exception to this is Mac instances, which are charged by the second of use instead, and generally require 24 hours of fees up front.
When compared to other EC2 instance pricing methods, On-Demand is thus a great way to go if you’re not ready to commit to a certain category of instance or amount of usage.
It doesn’t matter whether you’re developing or testing your app on EC2 for the first time, or if your app’s workloads are spiky or unpredictable. If you need more or different instances, or realize that you’re spending more than you need (or can afford) to, On-Demand is a great solution.
Alternatively, you can choose to commit to a Savings Plan. By committing to a term of 1 or 3 years of usage, you can reduce the cost of your EC2 instances by up to 72% compared to On-Demand.
These are useful for when you know that you’ll be using your instances for an extended period of time (eg, running a long-standing app or analyzing a static data set). However, if your usage is at all uncertain or unpredictable, you may well miss the flexibility that On-Demand Instances bring.
That’s not to say you can’t mix and match though!
For example, you could take out a Savings Plan and commit to a year of a set instance usage amount for your predictable workloads. Then, if something happens that means you need more instances, you could simply activate them on an On-Demand basis until your need goes away once more.
Reserved Instances are similar to Savings Plans in a number of ways. Both require a commitment of 1 or 3 years, and both reduce the cost of your instances versus On-Demand in return.
However, there are a few key differences.
First, Savings Plans are equivalent to you saying “I will use X for Y amount of time, so give me a discount on its use”. Reserved Instances are instead akin to you purchasing an instance for a specific amount of time.
It doesn’t matter how much you plan to use the instance - you’re paying for temporary ownership rather than negotiating a discount due to extended use.
As such, Reserved Instances can be resold on the Amazon EC2 Reserved Instance Marketplace. This lets you sell the instance to someone else for the remainder of the time you paid for.
On top of the time commitment, Reserved Instances also require you to commit to a specific instance tenancy and OS. If you choose a Compute Savings Plan instead of an EC2 Instance Savings Plan you would also be able to change Region and instance category freely, whereas Reserved Instances do not give you that luxury.
Reserved Instances also tend to be more expensive than an equivalent Savings Plan, as costs are discounted up to 66% of On-Demand pricing.
Spot Instances are unique because they effectively take up Amazon EC2 instances which are being unused and give you a heavy discount as a result. Think of it as Amazon EC2 offering you their surplus stock at a lower price so that they don’t lose out on a sale.
This can be an incredibly effective way to reduce your EC2 instance pricing, but the dependency on market demand means that the instances you need aren’t always going to be available as a Spot Instance.
Basically, once Amazon EC2 requires the instance again, your service will be interrupted as they take it back to resume business. You can set a request to purchase a Spot Instance as soon as it becomes available (when the market adjusts) but there’s no guarantee for how long you’ll be able to use it at that reduced price.
Spot Instances are therefore best suited to operations that won’t be destroyed by interruptions and aren’t time-sensitive.
Dedicated Hosts are physical EC2 servers that you purchase to dedicate fully to running your instances. This lets you use your existing per-socket, per-core, or per-VM software licenses to reduce your costs.
Dedicated Hosts are a great solution to corporate compliance requirements where you’re forced to use a dedicated server. It’s also a great way to fully manage your instances and their deployment if you already have the licenses to save yourself the cost of purchasing all of them.
Dedicated Instances are the more accessible cousin of Dedicated Hosts, as these are solely the instances which you’re reserving on a physical host, rather than taking full management of the host and instance management itself.
There are some minor price differences, and Dedicated Hosts are the way to go if you want to use your own licenses, but Dedicated Instances are a much easier way to meet compliance requirements for dedicated servers.
Finally, Capacity Reservations are a branch of On-Demand EC2 Instance Pricing which lets you reserve compute capacity for an instance in a specific AWS Region for a set length of time. Capacity Reservations can be used in conjunction with Savings Plans and Reserved Instances to further lower costs.
We’ve put this last amongst the EC2 instance pricing payment options because it doesn’t offer any kind of discount by itself. So, if your goal is just to save money, you’re out of luck here.
Capacity Reservations let you reserve the capacity for a set amount of time at no billing discount, but without committing to a time period like a regular Savings Plan. Basically, you say how long you want to reserve the capacity for, then pay regular On-Demand pricing for those resources as your reserved slots come and go.
Which option is right for you?
As we’ve laid out above, there is no one-size-fits-all solution when it comes to either your EC2 instance choice or your pricing payment method. We can, however, give you a few tips to help you on your way.
First, figure out what kind of workload you’ll need your instances to deal with.
Are you working with large data sets but still need high, sequential read and write access? You should consider a Storage Optimized instance. Developing an app on EC2 for the first time and need something with the flexibility to suit your project? General purpose would likely suit your needs.
Once you’ve chosen your instance category and picked which ones specifically you’re going to need, you’ll have a much better foundation from which you can see what the best payment option will be.
Here’s where subjectivity comes in, as working out which EC2 pricing option is best for you means that you’ll need to know:
- How consistently you’ll require specific instances
- How long you’ll be using those instances for
- Whether you can commit to a 1-or-3-year stretch of usage
- Whether you need to run your instances on a dedicated server
- How close you are to your AWS budget
Based on the answer to these questions you should be able to judge which payment options are best suited for your needs. For example, if flexibility is your primary concern and you’re nowhere near the limit of your AWS budget, sticking to On-Demand pricing for your instances isn’t a bad call.
However, if you want to maximize your savings and aren’t super tied down by the need for reliable access, Spot Instances can be a great way to achieve that.
How to monitor EC2 instance pricing
All that’s left now is to get a handle on what your current EC2 instance pricing is, and what your bill would look like if you made the changes you’ve all but decided on.
To calculate your current bill, look no further than the AWS Billing console. This allows you to easily see what your current bill comes to and break down the elements that it’s made of, including the instances you’re paying for and any discounts that have been applied.
Once you decide to take this to the next level it’s time to start using Aimably.
Aimably’s AWS Spend Transparency Software gives you the power to see your situation at a glance and forecast what your bill would look like if you made certain changes. It’s the best way to see what, say, changing to a Savings Plan or booking some Reserved Instances would do for your EC2 instance pricing without simply doing it and being ready to deal with the fallout.
Don’t leave your future up to chance. Sign up for an intro talk with Aimably today!