When choosing an EC2 instance family, it can be tempting to select a general-purpose family. Instead, it is worthwhile exploring the different types available based on what best fits your particular requirements. After all, the choice of EC2 instance family has a direct impact on the cost and performance of your application.
It is all too easy to end up in a situation where an application is no longer using the best fit EC2 instance for its needs. For instance, imagine a scenario in which an organization decides to deploy a new application on AWS. The team selects t2 instances because there is relatively little traffic. A few months pass and the application starts getting more requests and some new features are introduced. Without changing the EC2 instance type the organization continues with t2 instances and now they are facing some application performance issues. Given the application requirements evolved, t2 is no longer the optimal EC2 instance type since it is generally used for burstable workloads only. What the organizations should have done is evaluate the different EC2 instance families, considered the newly introduced application modules, and examined which kind of resources they require (memory/CPU) before introducing the application into a production environment.
Or, to pick another example, imagine a scenario where the cloud operation team is asked by the CTO to deploy an application downstream database in a clustered set-up. Initially, the team deploys a database cluster in two M5 instances and finds that cluster metrics are showing replication lags (latency). The team identifies a need for more memory and better network throughput. In this scenario, we recommend using R5n instances because they have 25 – 100 Gb bandwidth and memory optimized.
In this blog, we will explore the different factors the influence EC2 instance family selection, how to identify the EC2 instance types by their alpha-numeric characters, which processors and hypervisors go with the different EC2 instances. Finally, we will cover what use cases are most often associated with which EC2 instance family.
When choosing an AWS EC2 instance, there are several key considerations that need to be factored in. These include:
Available EC2 Instances
A1 T3 T3a T2 M6g M5 M5a M5n M4
C5 C5n C4
R5 R5a R5n R4 X1e X1 z1d u-*tb1.metal
P3 P2 Inf1 G4 G3 F1
I3 I3en D2 H1
Demystifying EC2 Instance Types
Family: High level usage identifier initial.
Generation: Version of type, which means latest generation of the instance.
Size: Compute, memory, GPU or resource proposition.
Identifying Instances by Initials
C – Compute optimized
D – Storage optimized local HDD disk throughput and volume
G – Accelerated computing graphic intensive GPU
H – Storage optimized local HDD based local storage and balanced CPU/memory
I – Storage optimized high IOPS SSD, low latency and sequential read
M – General purpose
P – Accelerated computing general purpose GPU
F – Accelerated FPGA compute
R – Memory optimized, require high memory
T – General purpose burstable instance (credits)
X – Memory optimized large scale in-memory database – HA and HP database
Z – Memory optimized with all core frequency of up to 4.0 GHz.
Understanding Detailed Usage
Using the following example of an instance type, m5d.xlarge, what is “d“?
Processors Used by EC2 Instances
AWS EC2 instances are backed with
AWS Graviton (AL73400)
The AWS Graviton (AL73400) – AWS re:Invent 2018
CPU: 16x ARM Cortex-A72 @ up to 2.3 GHz
Memory: Up to 32GB
Network Bandwidth: Up to 10 Gbit/s
EBS Bandwidth: Up to 3.5 Gbit/s
AWS Deployment: Amazon EC2 A1 instances
The AWS Graviton2 – AWS re:Invent 2019
CPU: 64x Arm Neoverse N1 @ up to 2.5 GHz
Memory: Up to 512GB
Enhanced Network Bandwidth: Up to 25 Gbit/s
EBS Bandwidth: Up to 18.5 Gbit/s
AWS Deployment: Amazon 6th generation M6g (R6g & C6g) instances
Hypervisor Behind EC2 Instance
All the old generation EC2 instances use Xen, and the majority of new instance types use AWS Nitro System.
AWS Nitro System
It is built on core Linux Kernel-based Virtual Machine (KVM) technology but does not include network and storage as operating system components. This hypervisor is typically used to manage the deployment of compute and memory resources.
EBS IO1 Multi attach – We can attach one EBS io1 volume to 16 EC2 instance within single AZ.
Which EC2 Instance Do I Need?
General Purpose – A1 T3 T3a T2 M6g M5 M5a M5n M4
Compute Optimized – C5 c5d C5n C4
Memory Optimized – R5 R5a R5n R4 X1e X1 z1d u-*tb1.metal
Accelerated Computing – P3 P2 Inf1 G4 G3 F1
Storage Optimized – I3 I3en D2 H1
Pause and Resume Instances
AWS now allows teams to pause instances without losing your settings. This is called hibernation. Instances that are backed with AWS Nitro can be hibernated, which means the memory data is saved into the root volume of the EC2 instance. When you re-start the instance, it will collect the data from root volume to memory and serve you immediately.