EC2 instance types and when to use them

Topic: Cloud aws core

Summary

EC2 instance types (t3, m5, c5, r5, etc.) offer different CPU, memory, and storage profiles. Choose by workload: general purpose, compute-optimized, memory-optimized, or storage-optimized. Use this when sizing a new instance or right-sizing for cost.

Intent: Decision

Quick answer

  • General purpose (t3, m5, m6i): balanced CPU and memory; good for web apps, dev, small DBs. Burstable (t3) uses credits for CPU; steady load may need m5/m6i.
  • Compute-optimized (c5, c6i): high CPU; batch, HPC, gaming. Memory-optimized (r5, x2i): large RAM; in-memory DBs, analytics. Storage-optimized (i3, d2): high disk throughput; data warehouses, NoSQL.
  • Pick the smallest type that meets the workload; use CloudWatch to check CPU and memory before resizing. Consider Spot for fault-tolerant or interruptible workloads to save cost.

Steps

  1. Match type to workload

    Web app or dev: t3 or m5. CPU-heavy batch: c5. In-memory DB or analytics: r5 or x2i. High disk I/O: i3 or d2. Check AWS instance type matrix for vCPU, memory, and network.

  2. Burstable vs steady

    t3 is burstable; CPU credits apply. For steady high CPU, use m5 or c5. For variable load, t3 can be cheaper if average CPU is low.

  3. Right-size with data

    Use CloudWatch CPU and memory metrics; if consistently low, downsize. If at limit, resize to the next size or switch family. Consider Graviton (ARM) for cost savings where supported.

  4. Spot and savings

    Spot instances are cheaper but can be interrupted; use for batch or fault-tolerant workloads. Reserved instances or Savings Plans for steady production to reduce cost.

Summary

Choose instance type by workload: general, compute, memory, or storage optimized. Right-size using CloudWatch; consider Spot for interruptible workloads and Reserved for steady production.

Prerequisites

None.

Steps

Step 1: Match type to workload

Map workload to family (t3/m5, c5, r5, i3); check vCPU, memory, and network in the instance type matrix.

Step 2: Burstable vs steady

Use t3 for variable load; use m5/c5 for steady high CPU.

Step 3: Right-size with data

Use CloudWatch; downsize if underused, resize or change family if at limit. Consider Graviton where supported.

Step 4: Spot and savings

Use Spot for batch or fault-tolerant; use Reserved or Savings Plans for production.

Verification

Instance type matches workload; metrics support the choice; cost options (Spot, Reserved) are considered.

Troubleshooting

t3 CPU throttled — Increase size or switch to m5 for steady CPU. Out of memory — Move to r5 or larger memory instance.

Next steps

Continue to