EC2 Instance Types Demystified: A Practical Guide to Choosing the Right Family
With over 500 EC2 instance types available, picking the wrong one is one of the most common — and costly — mistakes in AWS deployments. This guide cuts through the noise and gives you a systematic framework to match your workload to the right instance family, starting with a simple web application and scaling your mental model from there.
TL;DR — Instance Family Cheat Sheet
| Family | Optimized For | CPU:RAM Ratio | Typical Use Case | Example Types |
|---|---|---|---|---|
| T (Burstable) | Baseline CPU + burst credits | Balanced (variable) | Dev/test, low-traffic web apps, microservices | t3.micro, t3.medium, t4g.small |
| M (General Purpose) | Balanced CPU + RAM | ~1:4 (vCPU:GiB) | Production web servers, app servers, small DBs | m5.large, m6i.xlarge, m7g.2xlarge |
| C (Compute Optimized) | High CPU performance | ~1:2 (vCPU:GiB) | CPU-bound APIs, batch processing, gaming servers | c5.large, c6i.xlarge, c7g.2xlarge |
| R (Memory Optimized) | Large RAM pools | ~1:8 (vCPU:GiB) | In-memory caches, large DBs, real-time analytics | r5.large, r6i.xlarge, r7g.2xlarge |
| I (Storage Optimized) | High IOPS NVMe SSD | Balanced + fast local disk | NoSQL DBs, data warehousing, log processing | i3.large, i4i.xlarge |
| G / P (Accelerated) | GPU compute | GPU-heavy | ML training/inference, video transcoding | g4dn.xlarge, p3.2xlarge |
Decoding the Instance Type Naming Convention
Every EC2 instance type name follows a structured pattern. Once you understand it, you can decode any instance type at a glance.
Breaking down m6i.xlarge as an example:
- m — Instance family (General Purpose)
- 6 — Generation number (higher = newer hardware, better price-performance)
- i — Processor attribute:
i= Intel Ice Lake,a= AMD EPYC,g= AWS Graviton (ARM) - xlarge — Size within the family (nano → micro → small → medium → large → xlarge → 2xlarge → ...)
Analogy: Think of EC2 instance naming like a car model code — BMW 3 Series 330i xDrive. The "3" is the family (mid-size), "30" is the engine variant, "i" is the fuel type (petrol), and "xDrive" is the trim. You wouldn't buy a sports car to haul furniture, and you wouldn't rent a cargo van for a daily commute. Match the vehicle to the job.
The Processor Attribute Suffix — Why It Matters
| Suffix | Processor | Architecture | Key Benefit |
|---|---|---|---|
(none) |
Intel Xeon (older gen) | x86_64 | Broad software compatibility |
i |
Intel Ice Lake / Sapphire Rapids | x86_64 | High single-thread performance |
a |
AMD EPYC | x86_64 | Cost savings (~10% cheaper vs Intel equivalent) |
g |
AWS Graviton (ARM) | arm64 | Best price-performance for compatible workloads |
Note: Graviton (g suffix) instances require your application to be compiled for ARM64. Most modern Linux distributions, Docker images, and runtimes (Java, Python, Node.js, Go) support ARM64 natively. Always verify your dependency chain before migrating.
Deep Dive: The T Family (Burstable Performance)
The T family is the most misunderstood instance type. It operates on a CPU credit model — not a fixed CPU allocation.
- Baseline CPU: Each T instance size has a defined baseline CPU utilization percentage (e.g., t3.micro has a 10% baseline on 2 vCPUs).
- Credit Accrual: When CPU usage is below baseline, the instance earns CPU credits over time.
- Burst: When a spike occurs (e.g., a deploy, a cron job), the instance spends credits to burst above baseline — up to 100% of a vCPU.
- Credit Exhaustion: If credits run out and CPU demand remains high, performance is throttled back to baseline. This is the silent killer of T-instance production deployments.
- Unlimited Mode: T instances support
unlimitedmode, which allows sustained bursting beyond the credit balance — but you are charged for surplus CPU usage. This is enabled by default for T3 and T4g instances.
When to use T instances: Dev/test environments, internal tools, low-traffic blogs, microservices with spiky but infrequent load. When NOT to use T instances: Sustained CPU-intensive workloads, production databases, or any service with consistent high CPU demand.
Decision Framework: Choosing the Right Instance for a Web Application
Follow this decision tree to systematically select the right instance family for your workload.
Practical Sizing: A Simple Web Application
Let's apply this framework to a concrete scenario: a Node.js REST API backed by PostgreSQL, serving ~500 concurrent users.
Step 1 — Profile Your Workload
- CPU pattern: Moderate, with spikes during peak hours → not sustained high CPU
- Memory: Node.js process + connection pool → ~1-2 GiB needed
- Storage: Stateless app server → EBS is sufficient, no local NVMe needed
- Network: Standard web traffic → no specialized networking requirements
Step 2 — Eliminate Families
- ❌ R family — Memory optimized is overkill; you don't need 32+ GiB RAM for a Node.js app
- ❌ C family — Compute optimized is overkill unless you have CPU-bound processing (e.g., image resizing, heavy JSON parsing at scale)
- ❌ I family — No need for local NVMe; your DB is on RDS
- ❌ G/P family — No GPU workloads
Step 3 — Narrow to T vs M
| Criteria | T3.medium (2 vCPU, 4 GiB) | M6i.large (2 vCPU, 8 GiB) |
|---|---|---|
| Traffic pattern | ✅ Good for spiky/low traffic | ✅ Good for consistent traffic |
| CPU sustained | ⚠️ Throttled if credits exhausted | ✅ Full vCPU always available |
| RAM | ⚠️ 4 GiB (tight for growth) | ✅ 8 GiB (comfortable headroom) |
| Cost | ✅ Lower baseline cost | ⚠️ Higher but predictable |
| Production readiness | ⚠️ Risky without monitoring credits | ✅ Recommended for production |
Recommendation: Start with t3.medium for staging/dev. Use m6i.large or m7g.large (Graviton for ~20% better price-performance) for production. Enable Auto Scaling to handle traffic spikes rather than over-provisioning a single large instance.
Generation Matters: Always Prefer Newer Generations
Newer instance generations consistently deliver better price-performance. AWS improves CPU architecture, memory bandwidth, and network throughput with each generation — at the same or lower price point.
| Generation | Example | Processor | Guidance |
|---|---|---|---|
| 5th Gen | m5.large | Intel Skylake | Avoid for new deployments |
| 6th Gen | m6i.large, m6a.large, m6g.large | Intel/AMD/Graviton2 | Solid choice, widely available |
| 7th Gen | m7i.large, m7a.large, m7g.large | Intel/AMD/Graviton3 | Best current price-performance |
Rule of thumb: Always use the latest available generation unless you have a specific compatibility constraint. The price difference is minimal, but the performance gain is significant.
Cost Optimization Layer: Purchasing Options
Choosing the right instance type is only half the equation. The purchasing model determines your actual bill.
- On-Demand: Pay per second/hour. No commitment. Use for unpredictable or short-lived workloads.
- Reserved Instances (RI) / Savings Plans: Commit to 1 or 3 years for significant discounts (up to ~72% vs On-Demand). Use for stable, predictable production workloads. Compute Savings Plans offer more flexibility than instance-specific RIs.
- Spot Instances: Use spare EC2 capacity at steep discounts (up to ~90% off). Instances can be interrupted with a 2-minute warning. Use for fault-tolerant, stateless, or batch workloads — never for primary web servers without a robust interruption handler.
Practical strategy for a web app: Run your baseline capacity on Savings Plans (M or C family), and use Spot Instances in your Auto Scaling Group for burst capacity with a mixed instance policy.
Quick Reference: AWS Tools to Help You Choose
- EC2 Instance Types page: Official specs for every instance type.
- EC2Instances.info (by Vantage): Community tool for comparing specs and pricing side-by-side. (Third-party, not affiliated with AWS — verify pricing against official AWS pricing pages.)
- AWS Compute Optimizer: An AWS service that analyzes your CloudWatch metrics and recommends right-sized instance types for existing workloads. Requires at least 14 days of metric history.
- AWS Cost Explorer: Identify over-provisioned instances and Reserved Instance coverage gaps.
Glossary
| Term | Definition |
|---|---|
| vCPU | Virtual CPU — a hyperthread of a physical CPU core. Two vCPUs typically share one physical core. |
| CPU Credit | A unit of CPU capacity used by T-family burstable instances. One credit = one vCPU running at 100% for one minute. |
| Graviton | AWS-designed ARM-based processors (Graviton2, Graviton3) offering improved price-performance for compatible workloads. |
| Savings Plans | A flexible AWS pricing model offering discounts in exchange for a commitment to a consistent amount of compute usage (measured in $/hour) over 1 or 3 years. |
| Spot Instance | An EC2 instance that uses spare AWS capacity at a discounted price, subject to interruption when AWS reclaims the capacity. |
Next Steps
Start with the decision framework above, profile your actual workload metrics (CPU, memory, network), and use AWS Compute Optimizer on existing instances to get data-driven recommendations. For new deployments, default to the latest Graviton generation (e.g., m7g or t4g) if your stack supports ARM64 — it's the most cost-effective starting point in 2024. Always right-size before you right-purchase.
📖 Official reference: AWS EC2 Instance Types Documentation
Comments
Post a Comment