Close

Let's get on each others' calendars.

What Are the EC2 Instance Types?

How to Pick an Instance to Suit Your Workload

Different projects require different solutions. You can’t use a 5/16” wrench on a ¼” bolt, and you can’t use blu tack as a replacement for welding.

So why would you use EC2 instance types that don’t fit your workload’s requirements?

Today we’re going to cover everything you need to know to get started with all of the different (available) EC2 instance types, including what they’re useful for, when would be best to use them, and what kinds of workloads will get the biggest bang for your buck.

We’ll cover:

  • What are the EC2 instance types?
  • General purpose EC2 instances
  • Compute optimized EC2 instances
  • Memory optimized EC2 instances
  • Accelerated computing EC2 instances
  • Storage optimized EC2 instances
  • The best way to view your EC2 bill

Disclaimer: Amazon often updates its server types according to new technology releases. As such, instance types, specifications, and any prices in this article are accurate at the time of writing, being July 30th, 2022.

What are the EC2 instance types?

A photo of a stack of servers lining both sides of the corridor that is being looked down. The logo for AWS EC2 is superimposed over the center of the corridor, implying that these are servers hosting EC2 instance types
Source and source, images in the public domain

There are EC2 instance types for every kind of workload, each structured to fulfill the specific needs of your workload at the best price point possible. Whether you’re looking to run a NoSQL database, transcode multiple live video streams, host a SaaS app or even run a machine learning application, there’s an instance to fit you.

There are five EC2 instance categories, which all of the instance types fit into:

  • General purpose
  • Compute optimized
  • Memory optimized
  • Accelerated computing
  • Storage optimized

The instances in these categories each serve a rough common purpose, but each will do so with different technical specifications, with a different price point, and will be optimized for different workloads.

For example, compute optimized instances all focus on performance-intensive workloads, as they have the lowest price-per-CPU cost of all instances. However, C4 instances are more suited to scalable multiplayer gaming or video encoding, while Hpc6a instances are specifically designed to handle HPC workloads such as weather forecasting.

General purpose EC2 instances

As you’d expect from their name, EC2’s “general purpose” instances are a fantastic choice for the widest range of use cases. If you’re not sure what kind of instance would best suit your project or you just don’t require specific technical specs, general purpose is the way to go.

Due to their wide range of use cases it’s difficult to summarize everything about them in one place. The different general purpose EC2 instance types are suited to everything from running web servers and code repositories to app development, gaming, and even hosting mid-sized databases.

Here are the EC2 instance types classified as general purpose:

A1 instances are good for general purpose use, especially if the app you want to run on it doesn’t take much computing power, like a web server or caching fleet. The same is true of apps which are compiled for Arm architecture, as A1 instances use this to lower power requirements.

Meanwhile, M instance types are the true meaning of “general purpose”, as they’re a great starting point for anyone who is unsure of what the characteristics of their application are. They’re generally able to provide more computing power than A1 instances, but are also typically more expensive as a result.

We’ve covered T instances in detail before, but we’ll summarize things here too.

T instances are great for workloads which usually function with low CPU usage, with occasional spikes. This is because they have a set amount of hourly “credits” which build up as long as your CPU usage is below 20% of the instance’s limit. When it spikes above this you’ll use up your credits.

However, be wary of long periods of high CPU usage. If your usage is over 20% after your hourly credits have run out, T2 instances will throttle your performance (potentially causing operations to fail), and T3 instances will keep performing well but at an extra cost.

Compute optimized EC2 instances

A molecular dynamics simulation result of ice melting from the inside. This kind of simulation could be hosted on a ompute optimized EC2 instance type
Source by Masakazu Matsumoto, images used under license CC BY 2.0

If you’re in need of a more high-performance instance, EC2’s compute optimized instances are going to be the best choice. This is because they have the lowest price-per-CPU ratio of any instances.

Compute optimized instances are suited to batch processing workloads, scientific modeling, crash simulations, media and video encoding, machine learning inference, and even computational chemistry.

Here are the types of compute optimized EC2 instances:

  • C4
  • C5, C5a, C5d, C5n
  • C6a, C6g, C6gn
  • C6i, C6id
  • Hpc6a

Whereas general purpose instances vary in ideal use cases, almost all compute optimized instances are useful for the exact same purposes. The difference comes in terms of what the best price point for your requirements is.

For example, C5 instances offer a better price-per-vCPU than C4, and almost double the network bandwidth at 25 Gbps. In turn, C6 instances are more powerful and offer a relatively better price than C5, running on AWS Graviton2 processors based on 64-bit Arm architecture.

The main deciding factor comes in the form of your requirements and your budget.

Despite offering a better price performance, C5 instances are ultimately more expensive than C4, and C6 instances cost more than C5. Therefore, if you don’t need the better performance that those instances give you and are more focused on not going over budget, it might be worth considering a lower C4 instance than one of the fancy C6s.

Closing out the compute optimized category, Hpc6a instances are suited to high performance computing (HPC) workloads. Their power and scalability make them ideal for weather forecasting, computational fluid dynamics, and molecular dynamics.

Memory optimized EC2 instances

Memory optimized EC2 instances are designed to offer a larger memory size than most other instances, making them ideal for applications which are memory intensive. This can also include workloads which require fast performance while processing large data sets in memory.

You would benefit most from choosing a memory optimized instance if you were, say, running in-memory applications or databases, running a high-performance computing (HPC) application, or analyzing big unstructured data via real-time processing.

Here are the types of memory optimized EC2 instances:

  • R4
  • R5, R5a, R5b, R5n
  • R6g, R6gd
  • R6i, R6id
  • X1, X1e
  • X2gd, X2idn, X2iedn, X2iezn
  • High memory
  • Z1d

R instance types are great for running services like Redis, RabbitMQ or ElasticCache. If storage persistence isn’t essential and you’re wary of using the AWS serverless alternatives, R instances are a great choice.

R5 instances are roughly 10% cheaper than R4 instances (for the same performance) and offer 20% higher CPU performance, giving 5% more memory per vCPU. However, much like C5 vs C4 instances, R5 instances are ultimately more expensive than R4 due to their increased performance. If you don’t need the extra power, you’re wasting money on R5.

X instances have a much higher memory ratio, and are thus more suited to running a fully in-memory application.

Finally, Z1d instances are a little special in that they have a 4.0GHz sustained frequency, making them ideal for apps with a high per-core licensing cost.

Accelerated computing EC2 instances

A blue crcuit which forms the outline of a side-on view of the human brain. Behind the circuit and slightly larger than it is a vague view of the Earth from space, with yellow dots on its surface and hovering above it. This image invokes the idea of machine learning - one of the use cases for an accelerated computing EC2 instance
Source by www.vpnsrus.com, image used under license CC BY 2.0

Accelerated computing instances use hardware accelerators to provide sustained high performance. If you need powerful instances, this is where you’ll find them.

As a result, accelerated computing instances are great for anything which would put a large strain on CPUs alone. This includes machine learning, translation and transcription, any graphics-intensive app, 3D rendering, financial analytics, and so on.

Here are the types of accelerated computing instances:

  • DL1
  • F1
  • G3
  • G4ad, G4dn
  • G5, G5g
  • Inf1
  • P2, P3, P4
  • Trn1
  • VT1

To start things off easily, DL1 instances are suited to deep learning (hence the moniker “DL”). These are the instances to pick if you’re looking to utilize that particular type of machine learning.

F1 instances use field-programmable gate arrays (FPGAs) to provide programmable hardware acceleration. In plain English this means that they’re ideal for workloads involving financial analysis and real-time video processing. G instances are meanwhile suited to graphics-intensive workloads, such as 3D rendering, streaming, and video encoding.

Inf1 instances are the best general use instances for machine learning workloads. If you’re not looking to utilize deep learning but are still in the machine learning market, go for an Inf1 instance.

P instances are the most powerful available, with P2, P3, and P4 getting progressively more powerful and more expensive. P2 instances are suited to any high-demand GPU applications, whereas P3 and P4’s extra power only really benefits progressively more demanding machine learning applications.

I’ll let Adam Selipsky (CEO of AWS) tell you about Trn1 instances in his own words:

[The] Trn1 instance powered by Trainium [delivers] the best price-performance for training deep learning models in the cloud and the fastest on EC2… Trn1 is the first EC2 instance with up to 800 gigabytes per second bandwidth. So it’s absolutely great for large scale, multinode distributed training use cases.’ - Adam Selipsky, AWS re:Invent keynote

Rounding us out, VT1 instances are the powerhouse when it comes to video transcoding, making them invaluable for large-scale streaming. These instances are configured to offer better performance for transcoding at lower prices.

Storage optimized EC2 instances

The final category of EC2 instances is storage optimized instances. Once again, these are pretty much what you might expect from their name, as they specialize in working with large data sets on local storage while handling workloads that require access to that data.

For example, these instances are great for handling massive parallel processing (MPP) data warehousing, log or data processing apps, large data lakes, and NoSQL databases.

Here are the types of Storage Optimized instances:

  • D2
  • D3, D3en
  • H1
  • I3, I3en
  • I4i
  • Im4gn
  • Is4gen

D instances have large volumes of persistent storage, however this is also one of the few times where a type of instance is largely superfluous now. D2 instances are less powerful and slower than their D3 counterparts, but are also more expensive. In other words, if you have dense storage or distributed workloads such as high capacity data lakes, D3 and D3en instances are a good place to start.

H1 instances offer high throughput, making them fantastic for data-intensive workloads such as distributed file systems, log or data processing applications, and so on.

I3 instances utilize Non-Volatile Memory Express (NVMe) SSD-based storage to deliver high sequential read throughput and high IOPS at a low price. Due to this optimization (in performance and price) for I/O-heavy workloads, they’re suited to running database workloads, data warehousing, and analytics. I4 instances fulfill a similar role, albeit they offer up to twice the memory and storage size of the largest I3 instance, and while they generally offer up to 30% better compute price performance versus I3, their specs are different enough that it’s worth considering both versus your needs and budget.

The best way to view your EC2 bill

A photo of a woman in a blue blazer and shirt, and wearing glasses, holding up and looking at a piece of paper. The back of a Mac is also visible.
Source, image used under Pexels license

Other than browsing the specific options for which EC2 instance type you need, the only thing left to consider in your decision of which to use is their price. It’s here that there is some good news, and some bad news.

The good news is that we’ve already talked in-depth about EC2 instance pricing. That post serves as a great introduction to understanding roughly what you can expect your costs to be, and the different pricing options you have to save money (usually as a result of a commitment of time or usage).

The bad news is that, no matter what you pick, it can be an absolute nightmare to track and manage your EC2 bill.

That’s where Aimably comes in!

Aimably’s AWS Spend Transparency software gives you the full rundown of your AWS bill, letting you immediately see how much you’re spending and what those costs are made up of. You can easily see what your current EC2 instances are costing, and forecast what a change to your instance types would do to your costs.

In other words, you can see how much a change in instances would cost or save before ever touching your setup!

Aimably also offers an AWS Cost Reduction Assessment and AWS Financial Operations Services to show you the best ways you can reduce your costs and provide professional advice on the state of your finances respectively.

No matter what EC2 instance types you choose, you can’t go wrong with Aimably.

AWS Total Cost of Ownership