Reading35 min read·Module 3High exam weight

EC2 Instance Types & Selection

Key concepts

  • Instance families (M, C, R, T, etc.)

  • Graviton processors

  • Instance store vs EBS

  • Network performance

  • Instance metadata

Overview

Amazon EC2 provides a wide selection of instance types optimized for different use cases. Instance types comprise varying combinations of CPU, memory, storage, and networking capacity, giving you the flexibility to choose the appropriate mix of resources for your applications. Understanding instance type categories and their specific use cases is essential for optimizing both performance and cost on the SAA-C03 exam.

Core Concept

EC2 instance types are organized into five main categories: General Purpose (balanced), Compute Optimized (CPU-intensive), Memory Optimized (in-memory workloads), Storage Optimized (high I/O), and Accelerated Computing (GPU/ML). Instance naming follows the pattern: Family + Generation + Additional Capabilities + Size (e.g., m7i.xlarge = M family, 7th gen, Intel, xlarge size).

Exam Tip

Exam questions often present workload scenarios and ask you to select the appropriate instance type. Key signals: 'batch processing/HPC' → Compute Optimized (C), 'in-memory database/cache' → Memory Optimized (R), 'NoSQL database/data warehouse' → Storage Optimized (I), 'ML training/inference' → Accelerated (P/Inf). T-series is for burstable, variable workloads.

Key Concepts

Instance Type Naming Convention

EC2 Instance Type Naming Convention
Figure 1: Understanding EC2 Instance Naming

Instance Type Naming Format

Format: Family + Generation + Attributes + Size

Example: m7i.2xlarge

  • m = Instance family (General Purpose)
  • 7 = Generation (7th generation)
  • i = Additional capabilities (Intel processor)
  • 2xlarge = Size (8 vCPUs, 32 GB RAM)

Common Attribute Letters: | Letter | Meaning | |--------|---------| | a | AMD processors | | g | AWS Graviton processors (ARM-based) | | i | Intel processors | | d | Instance store volumes (NVMe SSD) | | n | Network optimized | | e | Extra capacity (storage or RAM) | | flex | Flexible instance | | z | High frequency |

Size Progression: nano → micro → small → medium → large → xlarge → 2xlarge → 4xlarge → 8xlarge → 12xlarge → 16xlarge → 24xlarge → 32xlarge → 48xlarge → metal

Metal Instances: Bare metal instances provide applications direct access to physical resources (no virtualization overhead).

General Purpose Instances

General Purpose Instance Families
Figure 2: General Purpose Instance Use Cases

General Purpose Instance Families

Balanced compute, memory, and networking resources

T-Series (Burstable Performance):

  • T4g (Graviton3), T3/T3a (Intel/AMD)
  • Baseline CPU performance with ability to burst
  • CPU credits accumulate during idle periods
  • Unlimited mode: Can burst beyond credits (at extra cost)
  • Use cases: Web servers, dev/test, small databases, microservices
  • Ideal for: Variable, low-to-moderate CPU workloads

M-Series (Balanced):

  • M8g (Graviton4) - Latest, best price-performance
  • M8i-flex (Intel Xeon 6) - 15% better than M7i-flex
  • M7i (Intel 4th Gen) - 15% better than M6i
  • M7a (AMD 4th Gen) - 50% better than M6a
  • M7g (Graviton3) - ARM-based efficiency
  • M6i/M6a/M6g - Previous generation

M-Series Characteristics:

  • Consistent performance (no busting)
  • Balance of compute, memory, networking
  • Use cases: Application servers, gaming servers, medium databases, caching fleets
  • Typical configuration: 1:4 vCPU to memory ratio
SHT3 Unlimited Mode Configuration
# Enable Unlimited mode on T3 instance
aws ec2 modify-instance-credit-specification \
  --instance-id i-1234567890abcdef0 \
  --instance-credit-specifications '[{"InstanceId": "i-1234567890abcdef0", "CpuCredits": "unlimited"}]'

# Check CPU credit balance
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUCreditBalance \
  --dimensions Name=InstanceId,Value=i-1234567890abcdef0 \
  --start-time 2024-01-01T00:00:00Z \
  --end-time 2024-01-01T23:59:59Z \
  --period 3600 \
  --statistics Average

# Monitor CPU credit usage
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUCreditUsage \
  --dimensions Name=InstanceId,Value=i-1234567890abcdef0 \
  --start-time 2024-01-01T00:00:00Z \
  --end-time 2024-01-01T23:59:59Z \
  --period 3600 \
  --statistics Sum

Compute Optimized Instances

Compute Optimized Instance Families

High-performance processors for compute-intensive workloads

C-Series (Compute Intensive):

  • C8g (Graviton4) - Latest ARM-based compute
  • C8i (Intel Xeon 6) - 15% better than C7i
  • C7a (AMD 4th Gen) - 50% better than C6a
  • C7g/C7gn (Graviton3) - Best price-performance
  • C7i (Intel 4th Gen) - x86 compatibility
  • C6i/C6a/C6g - Previous generation

Characteristics:

  • Highest compute performance per dollar
  • Latest generation processors
  • Up to 200 Gbps network bandwidth (C7gn)
  • Typical configuration: 1:2 vCPU to memory ratio

Ideal Use Cases:

  • Batch processing workloads
  • Media transcoding
  • High-performance web servers
  • Scientific modeling and simulations
  • Dedicated gaming servers
  • Ad serving engines
  • Video encoding
  • High-performance computing (HPC)
  • CPU-based machine learning inference
  • Distributed analytics

When to Choose C over M:

  • CPU utilization consistently >70%
  • Memory requirements are low relative to compute
  • Cost per compute hour is priority
  • Workload is parallelizable

C7gn - Network Optimized

Specialized for network-intensive compute workloads

C7gn Capabilities:

  • Up to 200 Gbps network bandwidth
  • 3x network bandwidth vs C7g
  • Powered by AWS Graviton3E processors
  • Dedicated Elastic Fabric Adapter (EFA)

Use Cases:

  • Network appliances (firewalls, routers)
  • Data analytics processing
  • CPU-based AI/ML inference
  • High-performance databases
  • Network function virtualization (NFV)

Network Performance Tiers: | Instance Size | Network Bandwidth | |--------------|-------------------| | c7gn.medium | Up to 25 Gbps | | c7gn.xlarge | Up to 40 Gbps | | c7gn.4xlarge | 50 Gbps | | c7gn.8xlarge | 100 Gbps | | c7gn.16xlarge | 200 Gbps |

Memory Optimized Instances

Memory Optimized Instance Families

Optimized for memory-intensive workloads

R-Series (Memory Intensive):

  • R8g (Graviton4) - Latest generation
  • R8i-flex (Intel Xeon 6) - 20% better price-performance
  • R7a (AMD 4th Gen) - 50% better than R6a
  • R7g (Graviton3) - Best price-performance
  • R7i (Intel 4th Gen) - x86 compatibility
  • R6i/R6a/R6g - Previous generation

Characteristics:

  • High memory-to-vCPU ratio (typically 8:1 or higher)
  • Optimized for large datasets in memory
  • Support for persistent memory (R6id, R7iz)
  • Typical configuration: 1:8 vCPU to memory ratio

Ideal Use Cases:

  • In-memory databases (Redis, Memcached)
  • In-memory analytics (Apache Spark, Presto)
  • Real-time big data analytics
  • High-performance databases (SAP HANA)
  • Distributed web scale in-memory caches
  • Genome analysis
  • Financial risk modeling

X-Series (Extreme Memory):

  • X2idn/X2iedn/X2iezn - Up to 4TB RAM per instance
  • X2gd (Graviton2) - Up to 1TB RAM
  • X1/X1e - Previous generation, up to 4TB RAM
  • Use cases: SAP HANA, Apache Spark, high-performance databases

High Memory Instances:

  • u-3tb1.56xlarge through u-24tb1.112xlarge
  • Up to 24TB of RAM
  • Purpose-built for large in-memory databases
  • SAP HANA certified
SHSelecting Memory Optimized Instance
# Describe R7g instance types and their specifications
aws ec2 describe-instance-types \
  --filters "Name=instance-type,Values=r7g.*" \
  --query 'InstanceTypes[*].[InstanceType,VCpuInfo.DefaultVCpus,MemoryInfo.SizeInMiB]' \
  --output table

# Find instances with minimum memory requirement (128 GB)
aws ec2 describe-instance-types \
  --filters "Name=instance-type,Values=r*" \
  --query 'InstanceTypes[?MemoryInfo.SizeInMiB>=`131072`].[InstanceType,MemoryInfo.SizeInMiB,VCpuInfo.DefaultVCpus]' \
  --output table

# Compare memory-to-vCPU ratios
aws ec2 describe-instance-types \
  --filters "Name=current-generation,Values=true" \
  --query 'InstanceTypes[*].[InstanceType,MemoryInfo.SizeInMiB,VCpuInfo.DefaultVCpus]' \
  --output json | jq '.[] | {type: .[0], memory_gb: (.[1]/1024), vcpus: .[2], ratio: (.[1]/1024/.[2])}'

Storage Optimized Instances

Storage Optimized Instance Families

High sequential read/write access to large datasets

I-Series (I/O Intensive):

  • I4i - Latest generation, up to 30 TB NVMe SSD
  • I4g (Graviton2) - ARM-based, best price-performance
  • I3/I3en - Previous generation

I4i Characteristics:

  • Up to 2 million IOPS
  • Up to 65 GB/s throughput
  • NVMe SSD instance store
  • Up to 100 Gbps network
  • Intel Xeon Scalable processors (Sapphire Rapids)

Ideal Use Cases:

  • NoSQL databases (Cassandra, MongoDB, Redis)
  • Relational databases (MySQL, PostgreSQL)
  • Data warehousing
  • Distributed file systems (HDFS, MapR)
  • Real-time analytics
  • Transactional databases

Im4gn/Is4gen (Graviton2):

  • Im4gn: Storage optimized with networking
  • Is4gen: Storage optimized with high storage density
  • AWS Graviton2 processors
  • Up to 100 Gbps networking

D-Series (Dense Storage):

  • D3/D3en - HDD-based dense storage
  • Up to 336 TB HDD storage
  • Use cases: MapReduce workloads, distributed file systems, log processing
  • Lower cost per GB than I-series

H1 Instances:

  • HDD-based storage optimization
  • Up to 16 TB HDD storage per instance
  • MapReduce-based workloads
  • Distributed file systems (HDFS, MapR)

Storage Instance Types Comparison

FamilyStorage TypeMax IOPSMax ThroughputBest For
I4iNVMe SSD2M IOPS65 GB/sLow-latency, high IOPS databases
I4gNVMe SSD1.1M IOPS44 GB/sCost-optimized NoSQL databases
Im4gnNVMe SSD1.1M IOPS44 GB/sNetwork-intensive + storage workloads
D3/D3enHDDModerateModerateSequential access, MapReduce
H1HDDModerateModerateBig data processing, cost-sensitive

Accelerated Computing Instances

Accelerated Computing Instance Families
Figure 3: GPU and ML Accelerated Instances

Accelerated Computing Instance Families

Hardware accelerators for parallel processing

P-Series (GPU Compute - Training):

  • P6 (B200/B300/e-GB200) - Latest NVIDIA Blackwell GPUs
  • P5/P5e/P5en - NVIDIA H100 Tensor Core GPUs
  • P4d/P4de - NVIDIA A100 GPUs, 400 Gbps networking
  • P3 - NVIDIA V100 GPUs

P5 Characteristics:

  • Up to 8 NVIDIA H100 GPUs per instance
  • 640 GB GPU memory
  • 3.2 TB/s GPU memory bandwidth
  • 3,200 Gbps EFA networking
  • Use cases: Large-scale AI/ML model training, LLM training

Inf-Series (ML Inference):

  • Inf2 - AWS Inferentia2 chips
  • Inf1 - First-gen AWS Inferentia
  • Purpose-built for ML inference
  • Up to 70% lower cost vs GPU instances

Trn-Series (ML Training):

  • Trn2/Trn2u - 2nd gen AWS Trainium
  • Trn1/Trn1n - AWS Trainium chips
  • Purpose-built for deep learning training
  • Cost-optimized alternative to P-series

G-Series (Graphics Intensive):

  • G6/G6e - NVIDIA L4/L40S GPUs for graphics + AI
  • G5/G5g - NVIDIA A10G GPUs
  • G4dn - NVIDIA T4 GPUs
  • Use cases: Graphics workstations, video encoding, gaming, ML inference

F-Series (FPGA):

  • F1/F2 - Field Programmable Gate Arrays
  • Custom hardware acceleration
  • Use cases: Genomics, financial analytics, video processing

VT1 (Video Transcoding):

  • Xilinx U30 media accelerators
  • Real-time video transcoding
  • Up to 8 accelerator cards

Accelerated Instance Use Cases

FamilyAcceleratorPrimary Use CaseKey Advantage
P5/P6NVIDIA H100/BlackwellLLM training, foundation modelsHighest GPU performance
Trn2AWS Trainium2Deep learning training40% better price-performance vs P5
Inf2AWS Inferentia2ML inference70% lower cost vs GPU inference
G6NVIDIA L4/L40SGraphics + AI inferenceBalanced graphics + ML
F2FPGACustom algorithmsProgrammable hardware acceleration
VT1Xilinx U30Live video transcodingPurpose-built for video

AWS Graviton Processors

AWS Graviton Advantage

ARM-based processors designed by AWS

Graviton Generations:

  • Graviton4 (2024+) - M8g, C8g, R8g
  • Graviton3/3E (2022) - M7g, C7g, R7g
  • Graviton2 (2020) - M6g, C6g, R6g, Im4gn
  • Graviton (2018) - A1 instances (legacy)

Performance Improvements: | Generation | vs x86 Price-Performance | vs Previous Graviton | |------------|--------------------------|----------------------| | Graviton4 | Up to 40% better | 30% faster | | Graviton3 | Up to 40% better | 25% faster | | Graviton2 | Up to 40% better | N/A (first major gen) |

Advantages:

  • Better price-performance ratio
  • Lower power consumption (better for sustainability)
  • Up to 60% lower energy consumption
  • Built on 64-bit ARM architecture

Workload Compatibility:

  • ✅ Most open-source software (Linux, containers)
  • ✅ Amazon Linux 2, Ubuntu, RHEL, SUSE
  • ✅ Containerized applications (Docker, ECS, EKS)
  • ⚠️ x86-specific binaries require recompilation
  • ❌ Windows workloads (Windows requires x86)

Best Practices:

  • Test workloads before migrating
  • Use multi-arch container images
  • Leverage AWS Lambda ARM support
  • Consider for new workloads (greenfield)
SHGraviton Migration Compatibility Check
# Check if Docker images support ARM64
docker manifest inspect amazonlinux:2023 | jq '.manifests[].platform'

# Build multi-architecture Docker images
docker buildx build --platform linux/amd64,linux/arm64 -t myapp:latest .

# Test application on Graviton instance
# Launch Graviton instance
aws ec2 run-instances \
  --image-id ami-0123456789abcdef0 \
  --instance-type m7g.large \
  --key-name my-key-pair \
  --security-group-ids sg-0123456789abcdef0 \
  --subnet-id subnet-0123456789abcdef0

# Compare performance and cost
aws ce get-cost-and-usage \
  --time-period Start=2024-01-01,End=2024-01-31 \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --filter '{
    "And": [
      {"Dimensions": {"Key": "INSTANCE_TYPE", "Values": ["m7g.large", "m7i.large"]}},
      {"Dimensions": {"Key": "SERVICE", "Values": ["Amazon Elastic Compute Cloud - Compute"]}}
    ]
  }' \
  --group-by Type=DIMENSION,Key=INSTANCE_TYPE

Best Practices

  1. Start with Latest Generation: Always use current generation instances (7th/8th gen) for best price-performance
  2. Consider Graviton: Test ARM-based Graviton instances for up to 40% cost savings
  3. Match Instance to Workload: Don't over-provision - use T-series for burstable, M for balanced, C for compute, R for memory
  4. Use Monitoring: CloudWatch metrics help identify if instance type is appropriately sized
  5. Leverage Instance Families: Use multiple sizes within same family for scaling (m7g.large → m7g.xlarge)
  6. Test Before Production: Benchmark performance on different instance types
  7. Consider Network Requirements: Use network-optimized variants (C7gn) for network-intensive workloads
  8. Evaluate Total Cost: Factor in CPU credits, networking, storage when comparing costs

Common Exam Scenarios

Exam Scenario Decision Guide

ScenarioRecommended Instance TypeKey Reasoning
Web application with variable trafficT3/T3a (burstable)CPU credits handle traffic spikes, save cost during low usage
Batch processing 1000s of filesC7g/C7i (compute optimized)High CPU performance, parallel processing capability
In-memory Redis cache clusterR7g (memory optimized)High memory-to-vCPU ratio, low latency
MongoDB database with high IOPSI4i (storage optimized)2M IOPS, NVMe SSD, low latency
Video transcoding pipelineG5 or VT1 (accelerated)GPU/hardware acceleration for video processing
SAP HANA database (2TB memory)X2idn or High Memory instanceExtreme memory capacity for in-memory database
Cost-optimized web tierM7g (Graviton)40% better price-performance, ARM compatibility
Financial risk modelingC7gn + R7i (compute + memory)High compute + memory, low-latency networking

Common Pitfalls

Using Previous Generation Instances

Older generation instances (M5, C5, R5) cost more per compute/memory unit than current gen (M7, C7, R7). Always select latest generation unless specific constraints require older gen. AWS may not offer Reserved Instance discounts for previous generations.

T-Series Credit Exhaustion

T-series instances in Standard mode stop bursting when CPU credits run out, causing performance degradation. Monitor CPUCreditBalance metric. Enable Unlimited mode if sustained CPU usage is needed, but beware of unexpected charges for surplus credits.

Graviton Compatibility Assumptions

Not all workloads run on Graviton without modification. Legacy applications with x86-specific dependencies, Windows workloads, and some commercial software may not support ARM architecture. Always test compatibility before committing to Graviton instances.

Over-Provisioning Instance Size

Choosing oversized instances "just to be safe" wastes money. Start with smaller sizes and scale up based on actual metrics. A m7g.xlarge costs half of m7g.2xlarge - use CloudWatch to right-size based on CPU/memory utilization.

Quick Reference

Instance Type Selection Matrix

Workload PatternCPU UsageMemory UsageRecommended Family
Variable, unpredictableLow-MediumLow-MediumT3/T3a
Balanced web/app serverMediumMediumM7g/M7i
Batch processingVery HighLow-MediumC7g/C7i
In-memory databaseMediumVery HighR7g/R7i
Transactional databaseMediumMedium-HighI4i
ML model trainingN/AVery HighP5/Trn2
ML inferenceN/AMedium-HighInf2/G6

Performance Progression (Example: M7g family)

Instance TypevCPUsMemory (GB)Network (Gbps)Hourly Cost
m7g.medium14Up to 12.5$
m7g.large28Up to 12.5$$
m7g.xlarge416Up to 12.5$$$$
m7g.2xlarge832Up to 15$$$$$$$$
m7g.4xlarge1664Up to 15$$$$$$$$$$$$$$$$
m7g.8xlarge3212815$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
m7g.16xlarge6425630$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

CLI Quick Reference

# List all instance types in a family
aws ec2 describe-instance-types --filters "Name=instance-type,Values=m7g.*"

# Find instances with specific vCPU count
aws ec2 describe-instance-types \
  --query 'InstanceTypes[?VCpuInfo.DefaultVCpus==`4`].[InstanceType]' \
  --output text

# Compare pricing (requires Price List API)
aws pricing get-products \
  --service-code AmazonEC2 \
  --filters Type=TERM_MATCH,Field=instanceType,Value=m7g.xlarge \
  --region us-east-1

# Check instance type availability in region
aws ec2 describe-instance-type-offerings \
  --location-type availability-zone \
  --filters Name=instance-type,Values=m7g.xlarge \
  --region us-east-1

Test Your Knowledge

Q

A company runs a web application that experiences traffic spikes during business hours (9 AM - 5 PM) but is nearly idle overnight. CPU utilization averages 20% but spikes to 80% during peak hours. Which instance type is MOST cost-effective?

Am7g.large (General Purpose)
Bt3.large (Burstable) in Standard mode
Ct3.large (Burstable) in Unlimited mode
Dc7g.large (Compute Optimized)
Q

A financial services company needs to run Monte Carlo simulations for risk analysis. The workload is CPU-intensive, runs 24/7, and requires minimal memory. Which instance type provides the BEST price-performance?

Am7g.4xlarge (General Purpose, Graviton)
Bc7g.4xlarge (Compute Optimized, Graviton)
Cm7i.4xlarge (General Purpose, Intel)
Dc7i.4xlarge (Compute Optimized, Intel)
Q

An e-commerce company runs a Redis in-memory cache requiring 256 GB of RAM with low latency access. Which instance type is MOST appropriate?

Am7g.8xlarge (128 GB memory)
Br7g.8xlarge (256 GB memory)
Cx2idn.16xlarge (1024 GB memory)
Di4i.8xlarge (256 GB memory)
Q

A machine learning team needs to train a large language model (LLM) with billions of parameters. Training will take several weeks. Which instance type provides the BEST cost-effectiveness for this workload?

Ap5.48xlarge (8x NVIDIA H100 GPUs)
Btrn2.48xlarge (AWS Trainium2)
Cinf2.48xlarge (AWS Inferentia2)
Dg5.48xlarge (8x NVIDIA A10G GPUs)

Further Reading


Sources:

Related services

EC2