DevDocsDev Docs
EC2

EC2 Instance Types

Choose the right instance type for your workload

Amazon EC2 provides a wide selection of instance types optimized for different use cases. Understanding instance types helps you optimize cost and performance.

Instance Naming

Instance names follow the pattern: [family][generation][processor].[size] Example: m6i.xlarge = M family, 6th gen, Intel processor, xlarge size

Instance Families

Balanced compute, memory, and networking. Ideal for diverse workloads.

TypevCPUsMemoryNetworkUse Cases
t3.micro21 GiBUp to 5 GbpsDevelopment, testing
t3.medium24 GiBUp to 5 GbpsSmall web apps
t3.large28 GiBUp to 5 GbpsMedium web apps
m6i.large28 GiBUp to 12.5 GbpsProduction apps
m6i.xlarge416 GiBUp to 12.5 GbpsDatabases
m6i.2xlarge832 GiBUp to 12.5 GbpsEnterprise apps

T-series (Burstable)

  • Baseline CPU performance with ability to burst
  • Good for variable workloads
  • Accumulate CPU credits when idle
  • Lower cost than fixed-performance instances

M-series (Fixed)

  • Consistent CPU performance
  • Best for steady-state workloads
  • No credit system

High-performance processors for compute-intensive tasks.

TypevCPUsMemoryNetworkUse Cases
c6i.large24 GiBUp to 12.5 GbpsBatch processing
c6i.xlarge48 GiBUp to 12.5 GbpsGaming servers
c6i.2xlarge816 GiBUp to 12.5 GbpsScientific modeling
c6i.4xlarge1632 GiBUp to 12.5 GbpsAd serving

Best for:

  • Batch processing
  • Media transcoding
  • High-performance web servers
  • Scientific modeling
  • Gaming servers
  • Machine learning inference

Fast performance for workloads that process large datasets in memory.

TypevCPUsMemoryNetworkUse Cases
r6i.large216 GiBUp to 12.5 GbpsIn-memory caching
r6i.xlarge432 GiBUp to 12.5 GbpsReal-time analytics
r6i.2xlarge864 GiBUp to 12.5 GbpsHigh-perf databases
x2idn.xlarge4128 GiBUp to 25 GbpsSAP HANA

Best for:

  • High-performance databases
  • Distributed in-memory caching (Redis, Memcached)
  • Real-time big data analytics
  • In-memory databases (SAP HANA)

High sequential read/write access to large datasets on local storage.

TypevCPUsMemoryStorageUse Cases
i3.large215.25 GiB1 x 475 NVMe SSDNoSQL databases
i3.xlarge430.5 GiB1 x 950 NVMe SSDData warehousing
d2.xlarge430.5 GiB3 x 2 TB HDDHadoop clusters

Best for:

  • Data warehousing
  • Distributed file systems
  • High-frequency OLTP
  • Elasticsearch clusters

Hardware accelerators (GPUs, FPGAs) for specialized workloads.

TypevCPUsMemoryGPUsUse Cases
p4d.24xlarge961152 GiB8 x A100Deep learning training
g5.xlarge416 GiB1 x A10GML inference
g4dn.xlarge416 GiB1 x T4Video transcoding
inf1.xlarge48 GiB1 x InferentiaML inference

Best for:

  • Machine learning training
  • High-performance computing
  • Graphics-intensive applications
  • Video encoding

Processor Options

Intel vs AMD vs Graviton

ProcessorInstance SuffixCostPerformance
Inteli (e.g., m6i)BaselineBest compatibility
AMDa (e.g., m6a)~10% lessSimilar to Intel
Graviton (ARM)g (e.g., m6g)~20% lessUp to 40% better price/performance

Graviton Recommendation

For new workloads, consider Graviton instances. They offer better price/performance for most applications. Ensure your software supports ARM architecture.

Launch Graviton Instance
aws ec2 run-instances \
  --instance-type m6g.large \
  --image-id ami-0123456789abcdef0 \
  --key-name my-key

T-Series Burstable Instances

T-series instances provide a baseline CPU performance with the ability to burst above the baseline.

CPU Credits

InstanceBaselineCredits/HourMax Credits
t3.micro10%6144
t3.small20%12288
t3.medium20%24576
t3.large30%36864

Credit Modes

  • Instance uses accrued credits for bursting
  • When credits depleted, performance drops to baseline
  • No additional charges
Set Standard Mode
aws ec2 modify-instance-credit-specification \
  --instance-credit-specification "InstanceId=i-1234567890abcdef0,CpuCredits=standard"
  • Instance can burst beyond credit balance
  • Charged for surplus credits used
  • Better for unpredictable workloads
Set Unlimited Mode
aws ec2 modify-instance-credit-specification \
  --instance-credit-specification "InstanceId=i-1234567890abcdef0,CpuCredits=unlimited"

Monitor unlimited instances closely to avoid unexpected charges from sustained high CPU usage.

Choosing the Right Instance

Understand Your Workload

  • CPU-bound: Compute optimized (c6i)
  • Memory-bound: Memory optimized (r6i)
  • Storage-bound: Storage optimized (i3)
  • Balanced: General purpose (m6i)
  • Variable: Burstable (t3)

Start Small and Scale

Begin with a smaller instance and monitor:

Resize Instance
# Stop instance
aws ec2 stop-instances --instance-ids i-1234567890abcdef0

# Change instance type
aws ec2 modify-instance-attribute \
  --instance-id i-1234567890abcdef0 \
  --instance-type m6i.xlarge

# Start instance
aws ec2 start-instances --instance-ids i-1234567890abcdef0

Use AWS Compute Optimizer

Get recommendations based on actual usage:

Get Recommendations
aws compute-optimizer get-ec2-instance-recommendations \
  --instance-arns arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0

Instance Features

Enhanced Networking

Higher packet per second (PPS) performance:

Check ENA Support
aws ec2 describe-instances \
  --instance-ids i-1234567890abcdef0 \
  --query 'Reservations[].Instances[].EnaSupport'

Nitro System

Modern EC2 instances use the Nitro System:

  • Better performance
  • Enhanced security
  • Bare metal capabilities
  • Required for some features (e.g., EBS encryption)

Placement Groups

Control instance placement for performance:

TypeUse Case
ClusterLow latency, high throughput (HPC)
SpreadCritical instances across hardware
PartitionLarge distributed workloads (Hadoop)
Create Placement Group
aws ec2 create-placement-group \
  --group-name my-cluster \
  --strategy cluster

Pricing Comparison

Approximate monthly costs (us-east-1, Linux):

InstanceOn-Demand1-Year RISpot
t3.micro$7.60$4.70$2.30
t3.medium$30.40$18.80$9.10
m6i.large$70.10$43.30$21.00
c6i.xlarge$124.10$76.70$37.20
r6i.large$91.98$56.80$27.60

Use Spot Instances for fault-tolerant workloads to save up to 90%. Use Reserved Instances or Savings Plans for steady-state workloads.

Next Steps

On this page