Which EC2 Instance Type is Right for You?

What Are EC2 Instances?

An Amazon Elastic Compute Cloud (EC2) instance is a virtual server that allows you to run your applications using the Amazon Web Services (AWS) computing environment. AWS is the world’s leading cloud computing platform, offering a growing number of services for application development, many of which are based on EC2. The EC2 service allows you to leverage AWS infrastructure to run workloads, scaling up to an unlimited number of virtual machines (VMs).

Amazon offers several instance types with varying memory, CPU, networking, and storage configurations to provide you with the computing resources you need. Each instance type is available at different scales, allowing you to address your changing workload requirements.

In this article:

Amazon EC2 Instance Type Categories

Amazon EC2 offers a wide range of instance types designed for various use cases. Each instance type has a specific networking, memory, CPU, and storage capacity configuration, allowing you to choose the optimal resource allocation for your applications. Each instance type is available in one or more sizes, providing the flexibility and scalability required to meet the resource requirements of your workloads.

EC2 instance types include:

  • General-purpose instance—provides a balance of networking, memory, and compute resources and is suitable for a diverse range of workloads. This instance type is useful for applications that require equal proportions of these resources (i.e., a code repository or webserver).
  • Compute-optimized instance—suitable for compute-intensive applications requiring high-performance computing (HPC) processors. This instance type can handle batch processing and HPC workloads, useful for media transcoding, machine learning, scientific modeling, and gaming applications.
  • Memory-optimized instance—suitable for use cases where speed is important. This instance type offers accelerated performance for workloads that process large volumes of data in memory.
  • Storage-optimized instance—suitable for storage-intensive workloads requiring sequential read and write access to locally stored datasets. This instance type is useful for running applications with low-latency operations.

Related content: Read our guide to EC2 instance pricing

AWS EC2 Instances in Depth

Here is a more detailed description of the Amazon EC2 instance types:

General-Purpose Instances

General-purpose instance options include:

  • A1 instance—an ARM-based option for EC2 instance types (as opposed to AMD or Intel processing). This option is best suited for container-based microservices or web servers and applications running on an open source tool like Python or Java.
  • M5 instance—the latest generation of general-purpose instance type, powered by Intel’s Xeon Platinum 8175 3.1Ghz processor. This option offers a balance of networking, memory, and cloud computing power and is suited for small mid-sized databases and data processing tasks. It can also serve as an enterprise application backend server.
  • T3 instance family—a burstable instance option, with T3 and T3a powered by Intel and AMD processors, respectively. T3 instances provide a less powerful, cost-effective alternative to the fixed M5 instance. They are useful for long-lived instances such as code repositories, web apps, and websites.

The following table shows specifications for instance types in the M5 series.

Source for this and the following images: AWS

Compute-Optimized Instances

Compute-optimized instance options include:

  • C5 instance family—a cost-effective option for compute-intensive workloads, includes C5, C5n, and C5d instances. With a C5d instance, you physically connect a local NVMe-based solid-state drive to the host server to achieve block-level storage for the instance’s lifetime.
  • C6 instance family—an AWS Graviton2 processor-powered option suited for highly advanced, compute-intensive applications (i.e., HPC, ad servers, video encoders, distributed analytics). This family includes C6 and C6g instances. The C6g instance has a 40% better price-performance ratio than C5.

The following table shows specifications for instance types in the C5 series.

Memory-Optimized Instances

Memory-optimized instance options include:

  • R5 instance family—includes R5, R5a, R5d, and R5n instances. Delivers up to 768 GiB of memory per vCPU. R5 instances are the evolution of R4 instances, providing 5% more memory and approximately 20% CPU performance improvement at a 10% lower cost than the R4 family. With an R5d instance, you physically connect a local NVMe-based solid-state drive to the host server to achieve block-level storage for the instance’s lifetime.
  • R6 instance family—an AWS Graviton2 processor-powered option, includes R6g and R6gd instances. This option is suited for memory-intensive workloads like in-memory caching and open source databases. R6 instances use customized AWS Graviton2 processors with an ARM Neoverse core of 64-bit. With the R6gd instance, you connect the NVME-based SSD to the host to enable block-level storage.
  • X1 instance family—an Intel Xeon-powered option, includes the X1 and X1e instances. These instances provide high memory for HPC and memory-intensive applications such as Apache Spark and SAP HANA. This option offers the highest memory-to-compute of all EC2 instance types, with the most affordable rate per GiB of RAM.
  • High memory instance—provides the highest possible RAM capacity (between 6TB and 24TB per instance). This option is useful for high in-memory databases and deploying databases like SAP HANA to AWS. However, high memory instances require dedicated hosts with a commitment to run the instances for three years.

The following table shows specifications for instances available in the R5 series.

Storage-Optimized Instances

Storage-optimized instance options include:

  • D2 instance—offers high-density storage (48TB of HDD) and high sequential read and write access for enterprise datasets. This option is suited to distributed Hadoop environments, providing cost-effective, high disk throughput (the cheapest EC2 option per disk). It is useful for MapReduce, MPP data warehousing, and log processing applications.
  • I3 instance family—a low-latency SSD-based storage option, includes I3 and I3en instances. I3 instances offer NVMe SSD storage with cost-effective high input/output per second (IOPS) and random input/output performance. This option is best suited for high-frequency applications such as online transaction processing systems, in-memory database caching, and relational databases.

The following table shows instance types available in the D2 series.

Accelerated Computing Instances

Accelerated computing instance options include:

  • P3 instance—a high-performance cloud computing option with network throughput of up to 100 GBPS and eight NVIDIA V100 Tensor Core GPUs. It is best suited for HPC and machine learning applications, delivering variable-precision performance of up to one petaFLOPS per instance to enable acceleration.
  • P2 instance—an Intel Xeon-powered, general-purpose option for GPU computing applications. It uses NVIDIA K80 GPUs and offers double-precision floating-point calculations and high-performance networking. This option is best suited for HPC databases and machine learning applications.
  • G4 instance—a graphics-oriented option powered by the second-generation Intel Xeon Scalable processor, based on the NVIDIA T4 Tensor Core GPU. This option is suited for graphics-heavy workload and machine learning inference acceleration. It supports NVIDIA Grid Virtual Workstation.
  • Inf1 instance—a cost-effective, low-latency option based on the second-generation Intel Xeon processor with 16 AWS Inferentia chips. This option is useful for developing deep learning APIs bundled with AWS Inferentia.

The following table shows specifications for instances available in the P3 series.

Read our guide: Choosing EC2 Instances and Pricing for Your Machine Learning Model

Which EC2 Instance Type is Right for Your Project?

The various EC2 instance types follow several patterns. There are numerous options, with as many as 18 configurations in an instance family. This large selection can be confusing when looking for the optimal instance type for your specific workload.

Depending on their requirements, compute-intensive applications could benefit from either an accelerated or compute-optimized instance type. For example, you might choose an accelerated instance for an app that would benefit from GPU acceleration or require many floating-point calculations.

On the other hand, you could use an HDD or SSD-based instance for an input/output-intensive, distributed computing application. The instance you choose depends on whether you prioritize cost or latency.

When comparing instance types, you need to understand the characteristics of your workload and how each instance works to select the right option. Choosing the wrong instance could degrade the performance of your application or cost you significantly in the long run. Consider any regulations or business policies that might limit your options.

Consider the technical constraints for each instance type:

  • What images can run on the instance?
  • Can you burst the networking or EBS?
  • What are your local storage limits?
  • What can you do manually or automate?

Working with EC2 Instances

Amazon EC2 is flexible, and there are several ways you can work with EC2 instances.

Accessing EC2 Instances via API

You must be familiar with XML, web services, and HTTP requests to access EC2 through an API. You should also know how to use at least one programming language (i.e., Python, Java, Ruby, C++, or C#).

You can use the EC2 Query API for HTTP or HTTPS requests (GET or POST). HTTP requests for an EC2 or spot instance must include the following:

  • Endpoint—the URL providing an entry point for the web service.
  • Version—the version of the API you can use.
  • Action—the action you want the API to perform (e.g., launching an instance with RunInstances).
  • Action parameters—these must be separated using &.
  • Authorization parameters—allow AWS to authorize and authenticate the request.

Related content: Read our guide to AWS EC2 CLI

Backing Up EC2 Instances with AWS Backup

AWS Backup offers a centralized location for backing up and automating data protection in various AWS services. It is a fully managed, cost-effective service that helps you simplify large-scale data protection using policies. You can leverage AWS Backup to guarantee business continuity and comply with data protection regulations.

AWS Backup lets you create backup jobs on-demand and customize your backup plan to cover the specified resources. When used with EC2 instances, AWS Backup helps you centralize your backup policy and compliance controls, enhance your organization’s security posture, and instantly access enterprise-level capabilities. Backing up an EC2 instance with AWS Backup extends protection to the Amazon EBS volumes attached to it, with all parameters stored in the same AMI.

Related content: Read our guide to AWS EC2 instance backup

Measuring the Performance of EC2 Instances

Amazon EC2 lets you provision various instance types with different CPU, memory, networking, and disk combinations. You can easily launch new instances and run tests simultaneously. You should measure the performance of your applications to validate their architecture and identify the best-suited instance types. Implement rigorous load and scale testing to verify the scalability of the applications.

Amazon EC2 offers ten instance types with various size options, grouped into six families based on the type of optimization. You can use the instance family at the starting point for assessing which instance type best meets your application’s requirements.

Use the following steps to evaluate your application’s performance:

  • Identify the appropriate instance family for your application, prioritizing requirements such as compute, memory, etc.
  • Assess your workload’s scale to identify the right instance sizes.
  • The most effective way to measure an application’s performance is to test the full application under real-world conditions. Architectural, infrastructural, and software limitations can all impact performance. You should thus implement application-level tests using load testing and application profiling tools.

EC2 Price Optimization with Spot by NetApp

AWS EC2 pricing models offer multiple instance types and various options for cloud spending optimization, but managing it all on your own is not so simple. To address the challenges of cloud infrastructure management, including EC2 cost optimization, Spot by NetApp offers a full suite of cloud management tools. These tools can help with everything from spend reporting and cost allocation, to running production and mission-critical workloads on EC2 spot instances, to maximizing utilization and ROI on EC2 reserved instances.

Reliably run workloads on spot instances for up to 90% savings
While the spare capacity offered by cloud providers has the potential for massive savings on cloud compute, using spot instances comes with risk of termination, with little warning.

Elastigroup from Spot by NetApp makes it easy to reliably leverage spot instances, enterprise-grade SLA, even mission critical and production workloads can benefit. Elastigroup provides every feature you’d expect from a standard cluster management platform, but raises the bar with predictive approaches to instance selection, auto-recovery and autoscaling, along with comprehensive dashboarding and advanced automation

Make the most out of your long-term cloud commitments
For cost-conscious companies, reserved instances and savings plans can help reduce costs up to 72%. These commitment pricing models are often a good match for long-term deployments, and stable, predictable workloads. However, if your application needs change, or you no longer need the resources you’ve committed to, you’re locked in.

Eco from Spot by NetApp manages and automates commitment lifecycles to offload unused capacity and automatically adjust capacity portfolios to maximum ROI.