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...

Abstract graphic of AWS cloud to depict DynamoDB pricing

AWS DynamoDB Pricing: 13 Tips to Reduce Costs

In this post, Karl Robinson introduces the technical elements of Amazon DynamoDB, and how to calculate DynamoDB Pricing. He also shares 13 invaluable tips on configuration to keep your AWS DynamoDB Costs under control. What Is Amazon DynamoDB? Amazon DynamoDB is the AWS fully managed NoSQL database service, enabling AWS customers to build NoSQL databases […]

View Post
Realistic set of bright yellow cargo containers. Front, side back and perspective view.

5 New Features in AWS Fargate Version 1.4

What is AWS Fargate? AWS Fargate is a serverless computing engine for containers that enables customers to deploy and manage applications, not infrastructure.  Fargate works with Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS), and enables customers to deploy container based applications without having to provision EC2 instances or Kubernetes pods. AWS […]

View Post
Graphic depicting AWS ecommerce website

AWS Ecommerce Best Practices

AWS provides a secure, high-performance infrastructure that can scale to any size e-commerce website. Marc’s best practice guidance on platforms, performance and scaling will help you make the right choices for your e-commerce business.

View Post
ebook featured image

5 Steps to a Successful

AWS Migration

DOWNLOAD FREE EBOOK