Skip to main content

04. EC2 Instance Types

Amazon EC2 (Elastic Compute Cloud) offers a wide range of instance types optimized for different use cases. Each instance type provides a combination of CPU, memory, storage, and networking capacity.


๐Ÿงฉ What is an EC2 Instance Type?โ€‹

An instance type defines the hardware configuration of our EC2 instance similar to choosing a server size in a data center.

Each instance type includes:

  • vCPUs (virtual CPUs)
  • Memory (RAM)
  • Storage options (EBS / Instance Store)
  • Network performance
  • Specialized hardware (e.g., GPUs, FPGAs)

๐Ÿ’ก EC2 Instance Naming Conventionโ€‹

Each EC2 instance type follows a simple naming rule:

m5.2xlarge

m โ†’ Instance family
5 โ†’ Generation number
m5 โ†’ Instance class (family + generation)
2xlarge โ†’ Size

Example: **m5.large**

Sizes scale up in power:
`nano โ†’ micro โ†’ small โ†’ medium โ†’ large โ†’ xlarge โ†’ 2xlarge โ†’ ...`


๐Ÿท๏ธ EC2 Instance Familiesโ€‹

Amazon groups EC2 instance types into families based on their target use cases.

FamilyCategoryUse Case
General PurposeBalanced compute, memory, networkingWeb servers, small databases
Compute OptimizedHigh CPU performanceGaming, batch processing
Memory OptimizedLarge memory capacityIn-memory databases, caching
Storage OptimizedHigh disk throughput and IOPSBig data, data warehousing
Accelerated ComputingGPU or FPGA accelerationML, AI, 3D rendering, HPC

โš™๏ธ Common EC2 Instance Families & Examplesโ€‹

1. ๐Ÿง  General Purposeโ€‹

General purpose instances provide a balance of compute, memory, and networking resources, and can be used for a variety of diverse workloads.

These instances are ideal for applications that use these resources in equal proportions, such as web servers and code repositories.

  • T Series (T2, T3, T4g) โ†’ Burstable performance
  • M Series (M5, M6i, M7i) โ†’ Balanced performance for general workloads

Example:
T3.micro โ€” 2 vCPUs, 1 GiB memory (Free Tier eligible)

2. โšก Compute Optimizedโ€‹

Compute optimized instances are ideal for compute-bound applications that benefit from high-performance processors. Instances that belong to this family are well suited for batch processing workloads, media transcoding, machine learning inference, and other compute-intensive applications.

  • C Series (C5, C6g, C7i)

Use cases:

  • Gaming servers, Batch Processing, Scientific modeling, High-performance web apps

3. ๐Ÿงฎ Memory Optimizedโ€‹

Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory.

Designed for memory-intensive(RAM) applications.

  • R Series (R5, R6i, R7i)
  • X Series (X2idn, X2iedn)

Use cases:

  • In-memory caching (Redis, Memcached)
  • Real-time analytics
  • High-performance databases
  • In-memory databases optimized for Business Intelligence (BI)
  • Applications performing real-time processing of large or unstructured data

4. ๐Ÿ’พ Storage Optimizedโ€‹

Storage optimized instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage.

They deliver tens of thousands of low-latency, random I/O operations per second (IOPS) to applications.

High local storage performance for large data sets.

  • I Series (I3, I4i)
  • D Series (D2, D3)
  • H Series (H1)

Use cases:

  • Big Data (Hadoop, Spark)
  • Data warehousing
  • Log or data processing

5. ๐Ÿง  Accelerated Computingโ€‹

Accelerated computing instances use hardware accelerators (co-processors) such as GPUs or FPGAs to perform specialized functions like floating-point calculations, graphics rendering, or data pattern matching. These accelerators execute such operations more efficiently than traditional CPUs, offering massive performance improvements for specific workloads.

  • P Series (P3, P4) โ†’ GPU for ML training
  • G Series (G4, G5) โ†’ Graphics and inference
  • F Series (F1) โ†’ FPGA for custom hardware logic

Use cases:

  • Machine learning
  • Deep learning
  • 3D rendering
  • Genomics

๐Ÿ’ก Choosing the Right Instance Typeโ€‹

RequirementBest Family
Balanced workloadGeneral Purpose (T, M)
High computeCompute Optimized (C)
Large memoryMemory Optimized (R, X)
High storage throughputStorage Optimized (I, D, H)
GPU accelerationAccelerated Computing (P, G, F)

๐Ÿงฎ Example Use Casesโ€‹

Use CaseRecommended Instance
Web server (small)t3.micro
Machine learning trainingp3.2xlarge
In-memory databaser6i.large
Big data analyticsi4i.xlarge
Gaming or HPCc7i.large

๐Ÿ“ˆ Scaling Instances Verticallyโ€‹

Unlike the instanceโ€™s AMI, the instance type can be changed after the instance is launched. Thus, we have the option to scale your instances by changing our instance type to give it more compute power. This kind of expansion is called vertical scaling.

Vertical scaling (scaling for more compute power per instance) gives you the ability to do the following:

โ€ข Scale up or down for CPU.

โ€ข Switch to any instance type in any instance family.

IAM diagram

๐Ÿงญ Summaryโ€‹

  • EC2 instance types are categorized by use case (compute, memory, storage, GPU).
  • Choose an instance that balances cost and performance for your workload.
  • You can resize or change instance types anytime to optimize usage.