AWS offers a range of EC2 instance types optimized for various purposes. It’s great that they provide so much variety, but of course, it means one more thing that you have to learn.

Read on for a look into each instance type and let’s compare the EC2 purchasing options

Remember that within each type, you’ll still need to choose instance sizes for your specific needs.

Additionally, older generations within each instance types are available for purchase – for example, c5 is the latest “c” instance, but c4 and c3 are still available – but as the newer types tend to perform better at a cheaper price, you’ll only want to use the older types if you have an AMI or other dependency.

This image shows a quick summary of what we’ll cover:

ec2 instance types comparison chart with mnemonics

Key Takeaways:

  • General Purpose Instances (t2, m5): Ideal for variable or consistent workloads, offering a balance of CPU, memory, and optional SSD storage.
  • Compute Optimized (c5): Best for compute-heavy applications like scientific modeling and intensive machine learning, with SSD options for faster storage.
  • Memory Optimized (r4, x1e): Suited for applications requiring high memory, such as in-memory databases and big data processing.
  • Accelerated Computing (p3): Provides GPU resources for tasks requiring intense graphics processing, like video editing and computational finance.
  • Storage Optimized (h1, i3, d2): Tailored for applications demanding high disk throughput and storage, from distributed file systems to NoSQL databases.

EC2 Instance Sizes Explained

Choosing the right EC2 instance size is crucial for optimizing performance and cost-efficiency. Each instance type offers various sizes to accommodate the specific needs of your workload.

For example, the “t2” instances range from “nano” to “2xlarge”, providing options for applications with low to moderate resource requirements.

On the other hand, “c5” instances go up to “24xlarge”, catering to compute-intensive tasks.

Remember, the larger the instance size, the more resources (CPU, memory, disk, network bandwidth) are available, but at a higher cost. Thus, selecting the right size involves balancing your application’s resource demands with your budget.

General Purpose

These general purpose EC2 instance types are a good place to start, particularly if you’re not sure what type to use. There are two general purpose types.

t2 instance type

The t2 family is a burstable instance type. If you have an application that needs to run with some basic CPU and memory usage, you can choose t2. It also works well if you have an application that gets used sometimes but not others. When the resource is idle, you’ll generate CPU credit, which you’ll utilize when the resource is used. It’s a cheaper option that’s useful for things that come and go a lot, such as websites or development environments.

We’ll also add a mnemonic to help you remember the purpose of each instance type.

Mnemonic: t is for tiny or turbo.

m5 instance type

The m5 instance type is similar, but for more consistent workloads. It has a nice balance of CPU, memory, and disk. It’s not hard to see why almost half of EC2 workloads are on “m” instances.

There’s also an m5d option, which uses solid state drives (SSD) for the instance storage.

Mnemonic: m is for main choice or happy medium.

Compute Optimized

c5 instance type

The c5 instance type has a high ratio of compute/CPU versus memory. If you have a compute-intensive application – maybe scientific modeling, intensive machine learning, or multiplayer gaming – these instances are a good choice. There is also the c5d option, which is SSD-backed.

Mnemonic: c is for compute (at least that one’s easy!)

Memory Optimized

r4 instance family

The r4 instance family is memory-optimized, which you might use for in-memory databases, real-time processing of unstructured big data, or Hadoop/Spark clusters. You can think of it as a kind of midpoint between the m5 and the x1e.

Mnemonic: r is for RAM.

x1e instance family

The x1e family has a much higher ratio of memory, so this is a good choice if you have a full in-memory application or a big data processing engine like Apache Spark or Presto.

Mnemonic: x is for xtreme, as in “xtreme RAM” seems to be generally accepted, but we think this is a bit weak. If you have any suggestions, comment below.

Accelerated Computing

p3 instance type

If you need GPUs on your instances, p3 instances are a good choice. They are useful for video editing, and AWS also lists use cases of “computational fluid dynamics, computational finance, seismic analysis, speech recognition, autonomous vehicles” – so it’s fairly specialized.

Mnemonic: p is for pictures (graphics).

Storage Optimized

h1 instance type

The h1 type is HDD backed, with a balance of compute and memory. You might use it for distributed file systems, network file systems, or data processing applications.

Mnemonic: h is for HDD.

i3 instance type

The i3 instance type is similar to h1, but it is SSD backed, so if you need an NVMe drive, choose this type. Use it for NoSQL databases, in-memory databases, Elasticsearch, and more.

Mnemonic: i is for IOPS.

d2 instance type

d2 instances have an even higher ratio of disk to CPU and memory, which makes them a good fit for Massively Parallel Processing (MPP), MapReduce and Hadoop distributed computing, and similar applications.

Mnemonic: d is for dense.


What EC2 instance types should you use?

As AWS has continued to add options to EC2, there are now EC2 instance types for almost any application. If you have comparison questions around pricing, run them through the AWS monthly calculator. And if you don’t know, then generally starting with t2 or m5 is the way to go.