AWS EC2 Instance Types: How to Select The Right One

Proper instance selection for workloads is an important decision with significant implications on development. In this article, we’ll go through the different Amazon EC2 instance families and types and the most important factors when selecting an EC2 instance.

We’ll cover each family in detail, with best practices, key considerations, and a step-by-step guide to choosing the right instance.

What are EC2 instance families?

AWS has different instance families, each designed for a specific use case, that allows you to configure your infrastructure for your application needs precisely. When choosing an instance, it’s important to consider: how much processing power, memory capacity, and storage space does it have?

Amazon EC2 instance families are distributed in groups to cover the following workloads: general-purpose computing, compute-optimized tasks, memory-intensive applications, storage-intensive workloads and GPU accelerated computing. Instance types comprise varying combinations of CPU, memory, storage, and networking capacity and come in various sizes, providing scalability and flexibility to handle different and changing demands.

Let’s discuss each family in more detail.

AWS EC2 Instance Types chart

General-Purpose Amazon EC2 instances:

A screenshot displaying General-Purpose Amazon EC2 instances

General-purpose Amazon EC2 instances, such as M7, M6, M5, Mac, T2 and T3 families, offer a balanced mix of CPU, memory, and networking resources. They are the perfect fix when you are not sure where the bottleneck in your workload could be.

Whether you are hosting web servers, running a small or  medium database, or doing experiments in your dev environment, general-purpose instances can provide the necessary horsepower without obliging you to worry about analyzing and profiling your application before selecting the ideal instance family.

Tips for Selecting General-Purpose Amazon EC2 Instances

M5, M6 and M7 EC2 instances include local NVMe-based SSDs for workloads that need temporary storage directly connected to the host server

M6g, M7g, T4g EC2 instances mark a shift towards processors designed by AWS (Graviton). They are optimized for performance and cost, with the Graviton processors offering up to 40% better price performance over comparable x86-based instances. M7g instances offer 20% higher enhanced networking bandwidth compared to M6g instances.

T2 and T3 instances are burstable, meaning they perform well for workloads that don’t use the full CPU often but occasionally need to burst to higher CPU performance. (Many applications such as web servers, developer environments, virtual desktops and small and medium databases don’t need consistently high levels of CPU, but benefit significantly from having full access to very fast CPUs when they need them.) T3 instance type is the next generation of T2, offering more computing power at a lower cost. T3a instances offer an AMD-based alternative with a balance of compute, memory, and network resources at a lower cost point.

Mac offers the ability to execute macOS workloads in the cloud on-demand to Apple developers. Developers can use Amazon EC2 Mac instances to create applications for a wide range of Apple devices including the iPhone, iPad, Mac, Vision Pro, Apple Watch, Apple TV, and Safari, by providing access to macOS environments. These are offered as dedicated, bare-metal instances.

Compute-Optimized Amazon EC2 Instances:

When your applications demand high CPU performance, compute-optimized instances are the perfect choice.

The C5, C6 and C7 Amazon EC2 instance families are engineered for compute intensive workloads involved in tasks like batch processing, scientific modeling, high performance web servers, and machine learning. With high-performance processors and optional local NVMe-based SSDs for fast data access, these instances can turbocharge your compute-intensive applications.

Tips for Selecting Compute-Optimized Instances

C7a are powered by 4th Generation AMD EPYC processors. They deliver up to 50% better performance compared to previous generation C6a instances.

C7i are powered by 4th Generation Intel Xeon processors and deliver up to 15% better performance compared to previous generation C6i instances.

C7g, C7gn are powered by AWS Graviton3 processors and C6g; C6gn are powered by AWS Graviton2 processors. They both provide up to a 40% boost in performance for compute intensive workloads compared to previous generation instances. However, the downside is that you can run only 64-bit Arm-compatible images on these particular Amazon EC2 instances.

Memory-Optimized Amazon EC2 Instances:

A screenshot displaying Memory-Optimized Amazon EC2 Instances

For workloads that process large datasets in memory, memory-optimized instances, including the X1, X2, High Memory, R5, R6, R6, R6 and newest R8 families, are your go-to.

These Amazon EC2 instances provide fast performance for applications like in-memory caches and databases, Hadoop/Spark clusters, big data analytics, and real-time processing of unstructured data.

Tips for Selecting Memory-Optimized Instances

R5, R6, R7, R8 Amazon EC2 instances are well-suited for applications that require a balance between memory performance and compute capacity. These instances offer a substantial amount of RAM and are optimized for applications such as high-performance databases, data mining, and in-memory databases like SAP HANA.

X1, X2 are often the best choice for the most demanding memory-intensive applications. They are perfect for large-scale, enterprise-class in-memory applications and big data processing engines. The X1 and X1e instances are part of this family, offering one of the highest memory capacities available in Amazon EC2. These instances are optimized for high-performance databases (e.g. Oracle DB, Microsoft SQL Server), in-memory databases (e.g. SAP HANA, Redis), and big data processing tasks.

High Memory EC2 instances are designed for large in-memory databases such as SAP HANA and big data processing engines that require large amounts of memory. Offering up to 24 TB of memory, these instances are tailored for mission-critical enterprise applications and massive in-memory databases, ensuring that businesses can run large scale-out workloads with ease.

Z1d EC2 instances offer both high memory and high compute capacity, featuring a high frequency Intel Xeon (Skylake 8151) Scalable processor. These Amazon EC2 instances are an excellent choice for electronic design automation (EDA), and certain relational database workloads with high per-core licensing costs.

Storage-Optimized Instances:

A screenshot displaying Storage-Optimized Instances

I4, I3, D2, D3 and H1 storage-optimized Amazon EC2 instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage.

The D2 and I3 families offer high-density storage for distributed file systems, data warehousing, and high-frequency online transaction processing (OLTP).

Tips for Selecting Storage-Optimized Amazon EC2 Instances

I3, I4 EC2 instances are optimized for high-performance databases, NoSQL databases, and other transactional databases requiring high IOPS. They provide NVMe SSD-backed instance storage optimized instances for low latency, high random I/O performance, and high levels of input/output operations per second (IOPS). I-series instances are ideal for workloads such as MongoDB, Cassandra, and other databases that benefit from high throughput and IOPS.

D2, D3 EC2 instances are designed for applications that require high disk throughput and density. Ideal for distributed file systems, data warehousing, and Big Data processing, D-series instances offer up to 48 TB of HDD-based local storage. They are optimized to deliver high performance for workloads requiring extensive read and write operations on large datasets stored locally.

H1 EC2 EC2 instances optimized for applications that need high disk throughput and IO, and they come with high-frequency Intel Xeon processors. These instances are a perfect match for high-performance computing (HPC) workloads, batch processing workloads, and data-intensive tasks such as MapReduce and distributed file systems.

Accelerated Computing Instances: ML, High Performance Computing, Graphics

A screenshot displaying Accelerated Computing Instances: ML, High Performance Computing, Graphics

P2, P3, P4, P5, G3, G4, G5, G6, Trn1, Inf1, Inf2, DL1, DL2q, F1, VT1 instance families are designed for applications that benefit from GPU acceleration like machine learning, high-performance computing (HPC), and graphics rendering.

These instances are equipped with powerful GPUs to speed up parallel processing tasks.

Tips for selecting Accelerated Computing Instances

P2, P3, P4, P5 are designed for powering Machine Learning and High Performance Computing, as general-purpose GPU computing. They are equipped with powerful NVIDIA GPUs, making them ideal for machine learning, computational finance, seismic analysis, speech recognition, autonomous vehicles, and drug discovery. Starting from P2 with up to 16 NVIDIA K80 GPUs, through P3 with NVIDIA V100 Tensor Core GPUs, to the latest P4 and P5 instances boasting NVIDIA A100 GPUs, the P-series offers escalating levels of computational prowess to meet the needs of cutting-edge applications.

G3, G4, G5, G6 are for graphics-intensive workloads, including 3D rendering, graphical workstations, gaming, and virtual reality. Starting with G3 instances powered by NVIDIA Tesla M60 GPUs, the series has evolved to include G4 instances with NVIDIA T4 GPUs, designed for machine learning inference and graphics-intensive applications. The G5 and the latest G6 instances further push the envelope with NVIDIA A10G and T4G Tensor Core GPUs, offering exceptional performance for graphics workloads.

Inf1, Inf2 are optimized for ML applications. Equipped with AWS Inferentia chips, these instances provide high throughput at low cost, enabling them to do tasks like image recognition, speech recognition and natural language processing. The Inf series offers an efficient and cost-effective solution for deploying complex ML models into production.

DL1, DL2q are purpose-built for deep learning. DL1 instances leverage Up to 8 Gaudi accelerators and are optimized for tensor operations, making them suitable for training complex deep learning models (object detection, image recognition, natural language processing, and recommendation engines). The newer DL2 instances are designed to offer optimized performance for deep learning workloads, running popular DL and generative AI applications, such as content generation, image analysis, text summarization, and virtual assistants.

F1 are for applications that require customizable hardware acceleration, offering field-programmable gate arrays (FPGAs). These instances are ideal for genomics research, financial analytics, real-time video processing, and big data search and analysis.

VT1 are designed for video transcoding workloads. Equipped with Xilinx Alveo U30 media accelerators, they are optimized for applications that require high-speed video processing, such as live broadcast, video on demand, and interactive video services

Different Amazon EC2 instance types within each of the families:

Each of the EC2 instance families listed above have different virtualized instance types available, starting from “.nano” and up to “.112xlarge”. Some of them also have dedicated “.metal” EC2 instance types. Let’s discuss the key considerations.

The power of bare metal

Amazon EC2 metal instances offer the raw performance of physical servers directly to users. Because they provide direct access to the underlying server’s physical hardware, bypassing the hypervisor layer, they offer lower latency (which is very important for workloads that are sensitive to any overhead introduced by virtualization).

Another advantage of bare metal is that users get the entire physical server, which means both CPU, memory, and storage resources are dedicated to a single tenant. This is ideal for applications that require consistent computing power. Isolation can also be key for workloads with stringent security or compliance requirements.

Virtualized instances

AWS also offers virtualized instances of different sizes, such as nano, 2xlarge, 4xlarge, … , 112xlarge, which are essentially slices of a physical server’s capacity. These instances run on the same physical hardware but are isolated from each other using AWS’s hypervisor.

Virtualized instances allow for precise scaling. For example, a 2xlarge instance offers a specific amount of CPU, memory, and storage, which is exactly half of what a 4xlarge instance offers. This allows users to choose an instance size that matches their workload requirements and optimize cost. And with various instance sizes available, users have more flexibility to upgrade or downgrade their EC2 instance size based on changing needs.

Choosing the Right EC2 Instance: A Step-by-Step Guide

Choosing the appropriate EC2 instance family and instance type has a significant impact on your applications’ performance and cost efficiency. Let’s go through the steps involved in choosing a suitable EC2 instance type for your workload.

Step One: Understand Your Application Requirements

Consider the storage, network, performance requirements of your application, including:

  • CPU Architecture: Does your application run on x86_64 or ARM?
  • CPU Intensity: Does your application require high CPU power for processing?
  • Memory Usage: Does your application need a lot of RAM?
  • Storage Needs: Will you require high IOPS (Input/Output Operations Per Second) or is standard storage sufficient?
  • Network Performance: Do you need high network bandwidth or low latency?
  • Special Requirements: If your application runs in ECS, you may need to select instance families that support ENI Trunking
  • Budget: What is your budget for AWS services?

Step Two: Select an instance family

In this step, you’ll need to choose between general-purpose, compute-optimized, storage-optimized, memory-optimized, and accelerated computing types.

The key consideration is which metric is most important for your workload — optimizing for this metric will help you run your workload in the most cost-efficient way possible.

Once you’ve selected the computing type, consider the specific needs of your application, technical documentation, and the advice above to choose the best specific instance family within it.

Step Three: Select an instance type and size

Instance sizes define the amount of virtual hardware assigned to your instance, like the number of vCPUs, the amount of memory, and the storage capacity. Amazon Ec2 instances range from sizes that provide only a fraction of a CPU core up to 64 vCPUs or more, allowing you to scale based on demand. Instance size is specific to your workload. You can determine a suitable size by running tests and monitoring CPU and memory usage. It’s advisable to maintain a safety margin, because consistently high utilization, such as 90%, offers little room for error and may necessitate a larger instance.

Step Four: Selecting pricing options

The pricing option you use also has a significant impact on cost efficiency. Let’s quickly run through the four main options; you can check out the full guide for more advice and tips on making good purchasing decisions on AWS.

On-Demand

The most flexible model, but the most expensive. You simply tell AWS what kind of cloud resources you need, at the moment that you need them. For maximum cost efficiency, your goal should be to have 0% of your compute running On-Demand.

Reserved Instances (RI)

Offer a substantial discount (up to 75% off On-Demand), but the least flexibility. Standard RIs require a commitment to a specific type of compute (EC2 instance family, region, operating system…).

Savings Plans (SP)

Offer discounts (up to 72% off On-Demand) in exchange for a commitment to using a certain amount of compute over 1 or 3 year periods. They offer additional flexibility compared to RIs, and are automatically applied by AWS to the spend that will result in the greatest discount.

Spot instances

Spare AWS capacity that users can purchase at a heavy discount. The trick is that AWS may need the capacity back at any time — potentially disrupting workloads if not managed properly.

Step Five: Monitor the performance of your app:

Before finalizing your decision, it is important to test how your selected instances perform in your application. Consider using tools like AWS Cost Explorer to monitor and manage your AWS spending. This can help you understand your usage patterns and iterate on your instance selection to optimize costs.

Why do engineers still need to manually choose EC2 instance types?

If you find that the steps above are not scalable, you’re not alone. Choosing EC2 instance types can be time-consuming due to the wide range of options, considerations, and detailed knowledge required about each option’s strengths and limitations.

Here, tools like Compute Copilot can be incredibly beneficial. As an intelligent workload provisioner, Compute Copilot manages your compute resources while optimizing cost savings through the use of cost-effective Spot instances. By automatically recommending the most suitable instance types based on specific workload requirements, Compute Copilot eliminates the need to manually navigate the extensive AWS architecture options.

A screenshot showing the nOps’ Compute Copilot dashboard for instance selection.
Once you specify your requirements, you instantly receive the full list of resources optimally tailored to your workloads. This feature is particularly invaluable for maximizing your Spot stability and savings with ASG or EKS.
(Tip: Why is Spot diversity important? Access to the largest, most diverse range of appropriate instance types is highly advantageous, because you’re not limiting yourself to a specific type or size, which may be in high demand and thus more likely to experience price spikes or be interrupted. By having the flexibility to choose from a broader pool of instance types, you can more easily find the cheapest and most reliable instances available at any given time, and in the case of termination, quickly shift workloads to another type with similar capabilities to avoid significant downtime.  Spot diversity also allows for more flexibility in leveraging available Reserved Instance and Savings Plan commitments. By providing additional capacity at a lower cost to cover spikes in demand, Spot can help you make fewer purchase commitments to retain operational flexibility — while still ensuring you get discounts on all of your compute).
You can manually choose from the list of workload-suitable families if desired, or select all eligible instance families for the broadest possible pool of cheap and reliable Spot instances that Copilot will automatically move your workloads onto.
After defining a template, you can re-use it in many different workloads. If your new workload needs a slight adjustment of the existing template, you can also use templates inheritance to inherit all the original settings by default.
A screenshot showing the nOps’ Compute Copilot dashboard for ASG Config template selection.

About nOps

nOps manages $1.5 billion in AWS spend, and was recently named #1 in G2’s Cloud Cost Management category.

Book a demo to find out how Compute Copilot can help you automatically manage and optimize your workloads for optimal performance and cost-efficiency.