AWS EC2 – Everything You Need to Know About EC2 Instances

Voiced by Amazon Polly

EC2 is short for Elastic Compute Cloud. It is Amazon Web Services IaaS (Infrastructure as a Service) offering that enables developers to gain easy access to compute resources in the AWS cloud.

AWS offer 275 EC2 ‘instances’, each with set a configuration of CPU, RAM, storage type and network performance.  The instances are grouped into ‘instance types’ which are optimized for different compute workloads. As there are so many options, it’s wise to monitor your EC2 workloads for performance and cost savings.

I include an introduction to CloudWatch Metrics, AWS’ Compute Optimizer and AWS purchasing options at the end of this post.

AWS Wall

How to remember instance types – Fight Dr McPixie!

A Cloud Guru, the AWS training and certification provider, has an amusing mnemonic in their AWS training programs to help remember the different instance families – ‘FIGHT DR McPIXIE’. 

Dr McPixie

With the advent of 2 new instance types, the mnemonic has been expanded – Dr McPixie is now Australian with the addition of A and U instances!

In fact, the letters are FIGHT DR MCPXZ AU – but it’s close enough and easy to remember. Here’s what the letters stand for:

  • F – FPGA
  • I – IOPS
  • G – Graphics
  • H – High disk throughput
  • T – cheap general purpose
  • D – Density
  • R – RAM
  • M – Main choice general purpose apps
  • C – Compute
  • P – Picture (graphics)
  • X – eXtreme memory
  • Z – Z-factor. Extreme memory and CPU
  • A – ARM based instances
  • U – Bare metal
EC2

EC2 Instance Families

AWS categorize the instance families as follows:

  • General Purpose
  • Compute Optimized
  • Memory Optimized
  • Accelerated Computing
  • Storage Optimized

Here’s how the letters from the mnemonic fit into the AWS instance families:

  • General Purpose
    • T – cheap general purpose
    • M – Main choice general purpose apps
  • Compute Optimized
    • C – Compute
  • Memory Optimized
    • R – RAM
    • X – eXtreme memory
    • Z – Z-factor. Extreme memory and CPU
  • Accelerated Computing
    • P – Picture (graphics)
    • G – Graphics
    • F – FPGA
  • Storage Optimized
    • I – IOPS
    • D – Density
    • H – High disk throughput

Missing from A Cloud Guru’s mnemonic are ‘High Memory’ and ‘Inf’ instance types, which we’ll come onto below.

Let’s summarise what each instance type is optimized for, and the instances that are available.

What are the different Instance Types

General Purpose

  • T – cheap general-purpose instances are available as follows:
    • T2 (7 configurations available) – Intel Xeon CPU, recommended for websites and webapps. They have a baseline level of CPU performance with the ability to burst above the baseline.
    • T3 (7 configurations available) – Intel Xeon CPU, recommended for micro services, low latency interactive applications, small and medium databases
    • T3A (7 configurations available)- like T3 but AMD EPYC 7000 series CPU.
  • M – Main choice for general purpose apps:
    • M4 (6 configurations available) – Intel Xeon Broadwell & Hasewell CPU, recommended for small & mid-size databases, data processing tasks requiring RAM, caching fleets or backend servers for SAP, Sharepoint or other clustered enterprise apps.
    • M5 (14 configurations available) – Intel Xeon Platinum CPU, recommended for small & mid-size databases, data processing tasks requiring RAM, caching fleets or backend servers for SAP, Sharepoint or other clustered enterprise apps.
    • M5a (14 configurations available) – AMD EPYC 7000 CPU, recommended for small & mid-size databases, data processing tasks requiring RAM, caching fleets or backend servers for SAP, Sharepoint or other clustered enterprise apps.
    • M5n – (14 configurations available) – Intel Xeon Cascade Lake CPUs, recommended for Web & App servers, small and medium databases, cluster computing, gaming servers, caching fleets & other enterprise apps.
    • M6g **NEW** (8 configurations available) – AWS Arm based Graviton CPUs, recommended for apps built on open source software – app servers, microservices, gaming etc.
  • A1 – **NEW** (6 configurations available) – AWS Graviton CPU, for scale out Arm based workloads
Chip CPU flat style. Computer processor. Microchip electronic technology. Microprocessor sign.

Compute Optimized

  • C – Compute optimized instances are available in the following families:
    • C4 – (5 configurations available) Intel Haswell CPUs, recommended for high-performance front-end fleets, web servers, batch processing, distributed analytics, high performance science and engineering apps and video encoding.
    • C5 – (18 configurations available, including 2 bare metal options) – Intel Xeon Cascade Lake CPUs, recommended for high performance web servers, scientific modelling, batch processing, HPC, AI/ML, ad servers, multiplayer gaming and video encoding.
    • C5n – (7 configuration options including one bare metal option) – Intel Xeon Platinum CPUs with AVX-512 instruction set, recommended for high performance web servers, scientific modelling, batch processing, HPC, AI/ML, ad servers, multiplayer gaming and video encoding.
Computer component Ram concept Isolated Line Vector Illustration editable Icon

Memory Optimized

  • R – RAM
    • R4 – (6 configurations available), Intel Broadwell CPUs, recommended for high performance databases, data mining & analytics, in-memory databases, web scale in-memory caches, Hadoop, Spark clusters etc.
    • R5 – (18 configurations available, including 2 bare metal options), Intel Platinum CPUs, recommended for high performance databases, real time big data analytics, mid-sized in memory databases.
    • R5a – (14 configuration options available), AMD EPYC 7000 CPUs, recommended for high performance databases, real time big data analytics, mid-sized in memory databases.
    • R5n – (16 configuration options available), Intel Cascade Lake CPUs, recommended for high performance databases, real time big data analytics, mid-sized in memory databases.
  • X – eXtreme memory
    • X1 – (2 configuration options available), Intel Haswell CPUs, recommended for SAP HANA, Apache Spark or Presto or High-Performance Computing (HPC) requirements.
    • X1e – (6 configuration options available, higher RAM than X1) – recommended for SAP HANA, Apache Spark or Presto or High-Performance Computing (HPC) requirements
  • Z – Z-factor. Extreme memory and CPU
    • Z1d – (7 configuration options available) – Custom Intel Scalable CPU, recommended for electronic design automation and relational database workloads with high per core licensing costs.
  • High Memory (5 bare metal options available) – Intel Skylake CPU, recommended for large enterprise databases including SAP HANA.
RGB

Accelerated Computing

  • P – Picture (graphics) – recommended for machine learning, high performance databases, computational fluid dynamics, computational finance, seismic analysis, genomics etc.
    • P2 – (3 configuration options available) – Intel Broadwell CPU, high performance NVIDIA GPUs.
    • P3 – (4 configuration options available) – Intel Broadwell CPU, up to 8 NVIDIA high performance GPUs.
  • Inf – Machine Learning Inference Applications
    • Inf1 – (4 Configuration Options available) – Custom AWS Inferentia CPU, recommended for recommendation engines, forecasting, image and video analysis, text & document analysis, voice recognition, translating, transcribing and fraud detection.
  • G – Graphics
    • G3 – (4 configuration options available) – Intel Broadwell CPUs, NVIDIA GPUs, recommended for 3D visualizations, graphics intensive remote workstations, application streaming, video encoding etc.
    • G4 – (7 configuration options available including single and multiple GPU VMs and 1 bare metal option) – Intel Cascade Lake CPUs, NVIDIA GPUs, recommended for machine learning inference applications and game streaming.
  • F – FPGA
    • F1 – (3 configuration options available) – Intel Broadwell CPUs, Xilinx FPGAs, recommended for genomics, financial analytics, real time video processing, big data search & analysis, and security.
Hard drive disk - black icon on white background vector illustration for website, mobile application, presentation, infographic. Modern computer memory device concept sign. HDD graphic design symbol.

Storage Optimized

  • I – IOPS – recommended for NoSQL databases – Cassandra, Mongo, Redis, in memory databases, scale out transactional databases, Elasticsearch & analytics workloads.
    • I3 – (7 configuration options available, including 1 bare metal) – Intel Broadwell CPUs, Non-Volatile Memory Express SSD Storage.
    • I3en – (8 Configuration options available, including 1 bare metal) – Intel Skylake CPUs, Non-Volatile Memory Express SSD Storage.
  • D – Density
    • D2 – (4 configuration options available) – Inten Xeon CPU, up to 48TB of HDD based local storage. Recommended for MPP Data Warehousing, Map Reduce and Hadoop, distributed or network file systems, log or data processing applications.
  • H – High disk throughput
    • H1 – (4 configuration options available) – Intel Xeon CPU, up to 16TB of HDD based local storage, recommended for Map Reduce workloads, Apache Kafka, big data workload clusters.
Choosing

Choosing the Right AWS EC2 Instance

Wow, that’s a lot of options!  275 instance configurations, 5 high level categories, 15 subcategories.  So how do you go about selecting the right instance type for your workload?

AWS tells you what workloads each instance type is suitable for, but it’s up to you to evaluate the important performance metrics for your applications & workloads and map those to the appropriate instance family and specification.

Once you’ve selected an instance type, you should also ensure that you continue to monitor your workloads running in AWS EC2, to ensure that you are still using the most appropriate instance type from both a performance and a cost management perspective. 

AWS Compute Optimizer logo

AWS Compute Optimizer makes recommendations to help improve performance or save money – but AWS Compute Optimizer currently only makes recommendations for M, C, R, T & X instance types.  You also need to ‘opt in’ to Compute Optimizer – it is not on by default. 

AWS Compute Optimizer analyses CloudWatch Metrics in order to make its recommendations:

  • CPU Utilization
  • RAM Utilization (requires a custom CloudWatch metric to be set up)
  • Network In
  • Network Out
  • Local Disk I/O

CloudWatch by default polls at 5-minute intervals – you’ll need to enable detailed monitoring to monitor resources at 1 minute intervals, and you may incur additional charges for this.

There are also a range of 3rd party tools that have this functionality, some can even combine performance metrics from third party monitoring tools into the recommendations.  Compute Optimizer  is limited to AWS CloudWatch metrics which may be polling less frequently than third party tools. 

You could also enlist the help of an AWS Partner or Managed Service Provider to help you with the ongoing optimization of your EC2 instances.

Changing EC2 Instance Type

If you decide that you need to change instance type for performance or cost management reasons, you can simply resize it to another instance type as long as:

  • Virtualization type is the same – PV (paravirtual) or HVM (Hardware virtual machine) – EC2 uses both virtualization types
  • CPU Architecture is the same – limited support for 32 bit AMIs, Arm processors etc
  • Network is compatible – newer instances need to be in a VPC, so EC2 classic instances can’t be resized to a newer instance type if not in a VPC
  • Root Storage is an EBS volume – if not, you’ll need to migrate your application to the new instance type.
  • Enhanced Networking Drivers are installed
  • NVMe Drivers are installed

When it may be time to change instance type, see this article for more detailed information and a step-by-step guide: How to Change or Upgrade an EC2 Instance Type

Purchasing Options

EC2 Instance Purchasing Options

As with all AWS services, there are several purchasing options for EC2 instances:

  • On-Demand – hourly metered billing
  • Standard Reserved Instance/Convertible Reserved Instance – 1 or 3 year commitment options, with discounts of up to 75% compared to On-Demand which vary by instance type and region
    • All Up Front – one off payment
    • Partial Up Front – 6 months up front with the balance on monthly payments
    • No Up Front – discounted monthly rate

Standard RIs can change Availability Zone, instance size and networking type.  If you need the flexibility to change instance family, operating system type or tenancy, you’ll need a Convertible RI.

  • Scheduled Reserved Instances – available to launch within the time window you reserve – this enables you to match your capacity reservation to a predictable recurring schedule. 
  • Compute Savings Plans – a flexible pricing model launched in November 2019 that enables you to commit to a consistent amount of compute usage in $/hour or a 1 or 3 year term in return for a discount of up to 66%
  • EC2 Instance Savings Plans – discounts of up to 72% in exchange for commitment to usage of individual instance families in a region, for example T2.Micro usage in EU (London)
  • Spot Instances – enables you to bid whatever price you want for instance capacity – instances only run when your bid price is met.

So, there you have it – everything you need to know about AWS EC2 instances, all in one place!

You Might Be Also Interested In These...

Hand arranging wood block stacking as step stair on paper pink background. Business concept growth success process, copy space.

Scalability in Cloud Computing & Why We Love AWS

In this post we’ll take a look at one of the key benefits of Cloud Computing – Scalability.  We’ll explore the different scaling options available for your cloud based workloads, and then we’ll take a look at specific services in AWS which can help you to achieve scalability for your AWS hosted applications.     Whether […]

View Post
Emigrated seagull flying in sunrise at Bangpu, Thailand

AWS Migration in 5 Simple Steps

Migrating your on-premises workloads to AWS may seem like a daunting task to the uninitiated.  It is however a process that has been repeated by many AWS customers, and one which has evolved and been refined over the years.  Here I’m going to outline the 5 major steps to an AWS Migration to demystify the […]

View Post
Digital identity scanner

AWS Identity and Access Management Best Practises

Correct use of AWS IAM is essential to ensure the security and integrity of workloads hosted in AWS – what are the IAM best practises?

View Post
ebook featured image

5 Steps to a Successful

AWS Migration

DOWNLOAD FREE EBOOK