Skip to main content

EC2 Instance Types

Understanding Instance Types​

The instance type determines the hardware resources (CPU, RAM, network, storage) available for your virtual server. AWS offers more than 500 instance types!

┌─────────────────────────────────────────────────────────────┐
│ INSTANCE NAMING CONVENTION │
├─────────────────────────────────────────────────────────────┤
│ │
│ t3.large │
│ │ │ │
│ │ └── Size (nano, micro, small, │
│ │ medium, large, xlarge, 2xlarge) │
│ │ │
│ └── Family + Generation │
│ (t=burstable, 3=3rd generation) │
│ │
│ Examples: │
│ • t3.micro = Burstable, 3rd gen, very small │
│ • m5.xlarge = General purpose, 5th gen, extra large │
│ • c6i.2xlarge = Compute optimized, 6th gen Intel │
│ • r5.4xlarge = Memory optimized, 5th gen │
│ │
└─────────────────────────────────────────────────────────────┘

Instance Families​

Overview​

┌─────────────────────────────────────────────────────────────┐
│ EC2 INSTANCE FAMILIES │
├─────────────────────────────────────────────────────────────┤
│ │
│ 🎯 GENERAL PURPOSE (T, M) │
│ Balanced CPU/RAM, general usage │
│ │
│ ⚡ COMPUTE OPTIMIZED (C) │
│ More CPU, intensive computing │
│ │
│ 🧠 MEMORY OPTIMIZED (R, X) │
│ More RAM, databases │
│ │
│ 💾 STORAGE OPTIMIZED (I, D, H) │
│ High I/O, big data │
│ │
│ 🎮 ACCELERATED COMPUTING (P, G, Inf) │
│ GPU, machine learning │
│ │
└─────────────────────────────────────────────────────────────┘

Family T - Burstable (General Purpose)​

┌─────────────────────────────────────────────────────────────┐
│ FAMILY T (Burstable) │
├─────────────────────────────────────────────────────────────┤
│ │
│ Features: │
│ • Burst capacity beyond baseline │
│ • Accumulates CPU credits when idle │
│ • Cost-effective for variable loads │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ CPU Usage │ │
│ │ │ │
│ │ 100%| ████ │ │
│ │ | ████ Burst (uses credits) │ │
│ │ 40%|──────────████─────────────── Baseline │ │
│ │ | ████ ████ │ │
│ │ 0%| ████ ████ │ │
│ │ └──────────────────────────────────► Time │ │
│ │ Accumulates Uses Accumulates │ │
│ │ credits credits credits │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Use cases: │
│ ✅ Variable traffic web servers │
│ ✅ Development environments │
│ ✅ Small databases │
│ ✅ Lightweight microservices │
│ │
│ ❌ Avoid if constant CPU load > baseline │
│ │
└─────────────────────────────────────────────────────────────┘

Common T Types:

TypevCPURAMBaseline CPUPrice/h (us-east-1)
t3.nano20.5 GiB5%$0.0052
t3.micro21 GiB10%$0.0104
t3.small22 GiB20%$0.0208
t3.medium24 GiB20%$0.0416
t3.large28 GiB30%$0.0832

Family M - General Purpose​

┌─────────────────────────────────────────────────────────────┐
│ FAMILY M (General Purpose) │
├─────────────────────────────────────────────────────────────┤
│ │
│ Features: │
│ • Balanced CPU/RAM │
│ • No burst (consistent performance) │
│ • Stable workloads │
│ │
│ Ratio: ~4 GiB RAM per vCPU │
│ │
│ Use cases: │
│ ✅ Business applications │
│ ✅ Application servers │
│ ✅ Enterprise backends │
│ ✅ Gaming servers │
│ ✅ Medium databases │
│ │
└─────────────────────────────────────────────────────────────┘

Common M Types:

TypevCPURAMPrice/h
m5.large28 GiB$0.096
m5.xlarge416 GiB$0.192
m5.2xlarge832 GiB$0.384
m6i.large28 GiB$0.096

Family C - Compute Optimized​

┌─────────────────────────────────────────────────────────────┐
│ FAMILY C (Compute Optimized) │
├─────────────────────────────────────────────────────────────┤
│ │
│ Features: │
│ • High CPU/RAM ratio │
│ • High-frequency processors │
│ • Ideal for intensive computing │
│ │
│ Ratio: ~2 GiB RAM per vCPU │
│ │
│ Use cases: │
│ ✅ Batch processing │
│ ✅ Video encoding │
│ ✅ High-performance game servers │
│ ✅ Scientific modeling │
│ ✅ Machine learning (inference) │
│ │
└─────────────────────────────────────────────────────────────┘

Common C Types:

TypevCPURAMPrice/h
c5.large24 GiB$0.085
c5.xlarge48 GiB$0.170
c6i.2xlarge816 GiB$0.340

Family R - Memory Optimized​

┌─────────────────────────────────────────────────────────────┐
│ FAMILY R (Memory Optimized) │
├─────────────────────────────────────────────────────────────┤
│ │
│ Features: │
│ • Lots of RAM │
│ • Ideal for in-memory data │
│ • High-performance databases │
│ │
│ Ratio: ~8 GiB RAM per vCPU │
│ │
│ Use cases: │
│ ✅ Relational databases │
│ ✅ Distributed cache (Redis, Memcached) │
│ ✅ Real-time analytics │
│ ✅ Apache Spark │
│ ✅ SAP HANA │
│ │
└─────────────────────────────────────────────────────────────┘

Common R Types:

TypevCPURAMPrice/h
r5.large216 GiB$0.126
r5.xlarge432 GiB$0.252
r5.2xlarge864 GiB$0.504

Quick Selection Table​

┌─────────────────────────────────────────────────────────────┐
│ INSTANCE SELECTION GUIDE │
├─────────────────────────────────────────────────────────────┤
│ │
│ Your need → Recommended Family │
│ ────────────────────────────────────────────────────── │
│ │
│ 💡 Tight budget, variable load → T3 (burstable) │
│ 🏢 Standard application → M5/M6i │
│ ⚡ Intensive CPU computing → C5/C6i │
│ 🧠 Database, cache → R5/R6i │
│ 💾 Big Data, data warehouse → I3/D2 │
│ 🎮 Machine Learning, GPU → P4/G4 │
│ │
│ Recommended starting size: │
│ • Dev/Test : .micro or .small │
│ • Production : .large or .xlarge │
│ • Scale up if necessary │
│ │
└─────────────────────────────────────────────────────────────┘

Processors and Generations​

Generation Suffixes​

SuffixMeaning
(none)Intel
aAMD (often cheaper)
gAWS Graviton (ARM, cost-effective)
iLatest generation Intel
dLocal NVMe storage
nEnhanced networking

Examples:

  • m5.large = Intel
  • m5a.large = AMD (10-20% cheaper)
  • m6g.large = Graviton (40% cheaper, ARM)
  • m5d.large = With local NVMe storage

AWS Graviton​

┌─────────────────────────────────────────────────────────────┐
│ AWS GRAVITON │
├─────────────────────────────────────────────────────────────┤
│ │
│ ARM processors designed by AWS │
│ │
│ Advantages: │
│ ✅ Up to 40% cheaper than Intel │
│ ✅ Better performance/price ratio │
│ ✅ Energy efficiency │
│ │
│ Constraints: │
│ ⚠️ Applications must support ARM │
│ ⚠️ Some software not compatible │
│ │
│ Compatible: │
│ ✅ Linux, containers, Node.js, Python, Java │
│ ❌ Windows, some legacy software │
│ │
└─────────────────────────────────────────────────────────────┘

Practical Exercise: Choosing the Right Type​

Scenario 1: WordPress Website​

Context:
- Small business showcase site
- 500 visitors/day
- Occasional peaks (promotions)
- Limited budget

Analysis:
- Variable load → Burstable
- Low traffic → Small type
- Budget → Cost-effective

✅ Recommendation: t3.micro or t3.small
Justification: Burst credits cover peaks,
minimal cost for low load

Scenario 2: PostgreSQL Database​

Context:
- Business application
- 50 concurrent users
- 100 GB database
- Complex queries

Analysis:
- Need RAM for cache → Memory
- Constant load → No burst
- Production → Stable performance

✅ Recommendation: r5.large or r5.xlarge
Justification: 16-32 GB RAM for PostgreSQL cache,
consistent performance

Scenario 3: Minecraft Game Server​

Context:
- 20 players max
- Modded world
- High responsiveness needed

Analysis:
- CPU intensive → Compute
- Mods = RAM → Medium
- Responsiveness → High CPU frequency

✅ Recommendation: c5.large or m5.large
Justification: Good CPU/RAM balance,
high CPU frequency for responsiveness

Best Practices​

1. Start Small​

DEV     →    TEST    →    STAGING    →    PROD
t3.micro t3.small t3.medium m5.large

Monitor metrics, then adjust.

2. Use Metrics​

CloudWatch Metrics to monitor:

CPU Utilization
├── < 20% consistently → Too large, downsize
├── 40-70% → Optimal
└── > 80% consistently → Too small, upsize

Memory Utilization
├── < 50% → Maybe too much RAM
└── > 80% → Risk of swap, upsize

3. Consider Graviton​

If your application is:
✅ Linux
✅ Containerized or interpreted (Python, Node, Java)
✅ Open source

→ Test Graviton instances (g) to save!

Summary​

FamilyFeatureUse Case
TBurstableDev, variable sites
MBalancedGeneral applications
CStrong CPUComputing, encoding
RStrong RAMDB, cache
I/DStrong storageBig Data
P/GGPUML, graphics

Validation Quiz​

  1. What does "t3.large" mean?
  2. Which family for an in-memory database?
  3. What is "burst" in the T family?
  4. Which suffix indicates an AMD processor?
  5. Why choose Graviton?
  6. What size to start with for a new project?

Next section: Authentication and Key Pairs