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:
| Type | vCPU | RAM | Baseline CPU | Price/h (us-east-1) |
|---|---|---|---|---|
| t3.nano | 2 | 0.5 GiB | 5% | $0.0052 |
| t3.micro | 2 | 1 GiB | 10% | $0.0104 |
| t3.small | 2 | 2 GiB | 20% | $0.0208 |
| t3.medium | 2 | 4 GiB | 20% | $0.0416 |
| t3.large | 2 | 8 GiB | 30% | $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:
| Type | vCPU | RAM | Price/h |
|---|---|---|---|
| m5.large | 2 | 8 GiB | $0.096 |
| m5.xlarge | 4 | 16 GiB | $0.192 |
| m5.2xlarge | 8 | 32 GiB | $0.384 |
| m6i.large | 2 | 8 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:
| Type | vCPU | RAM | Price/h |
|---|---|---|---|
| c5.large | 2 | 4 GiB | $0.085 |
| c5.xlarge | 4 | 8 GiB | $0.170 |
| c6i.2xlarge | 8 | 16 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:
| Type | vCPU | RAM | Price/h |
|---|---|---|---|
| r5.large | 2 | 16 GiB | $0.126 |
| r5.xlarge | 4 | 32 GiB | $0.252 |
| r5.2xlarge | 8 | 64 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
| Suffix | Meaning |
|---|---|
| (none) | Intel |
| a | AMD (often cheaper) |
| g | AWS Graviton (ARM, cost-effective) |
| i | Latest generation Intel |
| d | Local NVMe storage |
| n | Enhanced networking |
Examples:
m5.large= Intelm5a.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
| Family | Feature | Use Case |
|---|---|---|
| T | Burstable | Dev, variable sites |
| M | Balanced | General applications |
| C | Strong CPU | Computing, encoding |
| R | Strong RAM | DB, cache |
| I/D | Strong storage | Big Data |
| P/G | GPU | ML, graphics |
Validation Quiz
- What does "t3.large" mean?
- Which family for an in-memory database?
- What is "burst" in the T family?
- Which suffix indicates an AMD processor?
- Why choose Graviton?
- What size to start with for a new project?
Next section: Authentication and Key Pairs