Skip to main content
AWSComputebeginner

EC2 Instance Types Explained

Understand EC2 instance families, Graviton, and how to choose the right instance for your workload.

CloudToolStack Team24 min readPublished Feb 22, 2026

Prerequisites

  • AWS account with EC2 access
  • Basic understanding of compute concepts (CPU, RAM, network)

Understanding EC2 Instance Type Naming

EC2 instance type names follow a consistent naming convention that tells you exactly what you are getting. Understanding this convention helps you quickly identify the right instance family for your workload without memorizing hundreds of instance types. AWS adds new instance types regularly, but the naming convention remains consistent.

The format is: [family][generation][additional capabilities].[size]. For example, m7g.xlarge means:

  • m: General purpose family
  • 7: 7th generation
  • g: Graviton (ARM) processor
  • xlarge: 4 vCPUs, 16 GiB memory

Each size doubles the resources of the previous size. An xlarge has 4 vCPUs, 2xlarge has 8, 4xlarge has 16, and so on up to metal (bare metal) for the full physical server. The nano, micro, small, medium, and large sizes provide smaller increments for lightweight workloads.

Processor and Capability Suffixes

SuffixMeaningExample
gAWS Graviton (ARM64) processorm7g, c7g, r7g
aAMD EPYC processorm7a, c7a, r7a
iIntel Xeon processorm7i, c7i, r7i
dLocal NVMe SSD instance storagem7gd, c6id, r6id
nEnhanced networking (higher bandwidth)c7gn, m7i-flex
eExtra memory (higher memory-to-CPU ratio)r7iz (memory-optimized with Intel)
flexFlex instance (burstable alternative)m7i-flex
metalBare metal (no hypervisor)m7g.metal, c7i.metal-24xl

Default to Graviton

Graviton (ARM) instances deliver up to 40% better price-performance than comparable x86 instances. Unless your workload specifically requires x86 (certain licensed software, Windows-only applications, or dependencies without ARM builds), start with Graviton. Most Linux-based applications work without changes on ARM64. Use multi-arch Docker images (docker buildx) to support both ARM64 and AMD64 architectures during migration.

Instance Families Explained

AWS organizes instance types into families based on the type of workload they are optimized for. Choosing the right family is the most important instance selection decision. Each family has a specific vCPU-to-memory ratio that determines its suitability for different workload profiles.

General Purpose (M, T Family)

General purpose instances provide a balance of compute, memory, and networking resources. They are the default starting point for most workloads. The M-family provides fixed performance, while the T-family provides burstable performance at a lower baseline price.

Compute Optimized (C Family)

Compute optimized instances have a higher ratio of CPU to memory (1:2) and are ideal for workloads that are CPU-bound. They provide the highest per-core performance available on EC2.

Memory Optimized (R, X, z Family)

Memory optimized instances have a higher ratio of memory to CPU (1:8 or higher) and are designed for workloads that process large datasets in memory. The X and z families provide extremely high memory (up to 24 TiB for x2idn).

FamilyCategoryvCPU:Memory RatioBest For
T4g / T3Burstable1:2 (with CPU credits)Dev/test, small web servers, microservices, CI/CD agents
M7g / M7iGeneral Purpose1:4Web servers, app servers, backends, mid-size databases
C7g / C7iCompute Optimized1:2Batch processing, HPC, gaming servers, ML inference, video encoding
R7g / R7iMemory Optimized1:8In-memory databases (Redis, SAP HANA), real-time analytics
X2gd / X2idnMemory Intensive1:16+SAP HANA, large in-memory caches, electronic design automation
I4g / I4iStorage Optimized1:8 + local NVMeHigh I/O databases (Cassandra, ScyllaDB), data warehousing
P5 / P4dGPU (Training)GPU-basedML/AI training, large language models
G5 / G6GPU (Inference/Graphics)GPU-basedML inference, video encoding, 3D rendering, game streaming
Inf2ML InferenceInferentia chipsCost-optimized ML inference with AWS Inferentia2
Trn1ML TrainingTrainium chipsCost-optimized ML training with AWS Trainium
HPC7gHigh Performance ComputeVariesTightly-coupled HPC workloads, weather modeling, CFD

Burstable vs Fixed Performance

T-family instances (T3, T3a, T4g) use a CPU credit system that allows you to burst above a baseline performance level. Each instance earns CPU credits at a fixed rate and spends them when CPU exceeds the baseline. This model is cost-effective for workloads with variable CPU usage (like web servers that handle occasional spikes) but can be problematic for sustained high-CPU scenarios.

CPU Credit System

InstancevCPUsBaseline CPUCredits/HourMax Burst Duration
t4g.micro210%6~1 hour at 100%
t4g.small220%12~1.5 hours at 100%
t4g.medium220%12~1.5 hours at 100%
t4g.large230%36~2.5 hours at 100%
t4g.xlarge440%96~2.5 hours at 100%

Unlimited Mode Costs

T-family instances default to “unlimited” mode, which charges $0.05 per vCPU-hour for surplus credits when your CPU exceeds the baseline for extended periods. This can result in unexpected charges that make the burstable instance more expensive than a fixed-performance M-family instance. MonitorCPUSurplusCreditBalance in CloudWatch. If your instance consistently runs above its baseline CPU, switch to an M or C family instance.

check-burstable-credits.sh
# Check CPU credit balance and surplus for burstable instances
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUCreditBalance \
  --dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
  --start-time $(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ) \
  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
  --period 3600 \
  --statistics Average \
  --output table

# Check for surplus credit charges (unlimited mode)
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUSurplusCreditBalance \
  --dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
  --start-time $(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ) \
  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
  --period 3600 \
  --statistics Maximum \
  --output table

# Find all burstable instances with low credit balance
aws ec2 describe-instances \
  --filters "Name=instance-type,Values=t3.*,t4g.*" \
  --query 'Reservations[].Instances[].{
    Id: InstanceId,
    Type: InstanceType,
    Name: Tags[?Key==`Name`].Value | [0]
  }' \
  --output table

M7i-flex: The Burstable Alternative

The M7i-flex instance type provides a middle ground between burstable T-instances and fixed M-instances. It offers a 5% discount compared to M7i with a 95% baseline CPU performance (vs. 100% for M7i). For workloads that rarely need 100% CPU, M7i-flex provides the stability of a general-purpose instance at a lower price point.

Graviton: AWS Custom Silicon

AWS Graviton processors are custom ARM-based chips designed by AWS for cloud workloads. Graviton instances offer the best price-performance for most workloads and are available across general purpose (M7g), compute optimized (C7g), memory optimized (R7g), and other families. AWS has progressively improved Graviton across three generations.

GenerationKey ImprovementAvailable Families
Graviton (1st gen)First ARM instance on EC2A1 (deprecated)
Graviton240% better price-performance vs x86M6g, C6g, R6g, T4g, X2gd
Graviton325% improvement over Graviton2M7g, C7g, R7g, I4g, HPC7g
Graviton4Additional performance and efficiency gainsM8g, C8g, R8g (rolling out)

Graviton Migration Checklist

  • Check application compatibility: Most Linux applications, containers, and managed runtimes (Python, Node.js, Java, .NET 6+) work on ARM64 without changes
  • Build multi-arch container images: Use docker buildx build --platform linux/amd64,linux/arm64 to create images supporting both architectures
  • Verify dependency availability: Check that all native binary dependencies have ARM64 builds. Most popular packages support ARM64.
  • Test performance: Run benchmarks on Graviton before committing. Some workloads (particularly those using x86-specific SIMD instructions) may not see the full 40% improvement.
  • Update AMIs and launch templates: Use ARM64 AMIs (Amazon Linux 2023 supports both architectures). Update Auto Scaling group launch templates.
multi-arch-docker.sh
# Build multi-architecture Docker image for Graviton
# Supports both x86_64 (amd64) and ARM64 architectures

# Create and use a new buildx builder
docker buildx create --name multiarch --driver docker-container --use

# Build and push multi-arch image to ECR
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --tag 123456789012.dkr.ecr.us-east-1.amazonaws.com/app:v1.0 \
  --push \
  .

# Verify the image supports both architectures
docker manifest inspect \
  123456789012.dkr.ecr.us-east-1.amazonaws.com/app:v1.0 \
  | jq '.manifests[].platform'

Graviton Savings Stack with Savings Plans

Graviton instances are approximately 20% cheaper than equivalent x86 instances at On-Demand pricing. Combined with a Compute Savings Plan (30-60% discount), the total savings can exceed 50-70% compared to On-Demand x86. This makes Graviton with a Savings Plan the most cost-effective configuration for steady-state workloads.

ECS vs EKS Decision Guide: Running Containers on Graviton

Right-Sizing Your Instances

Most organizations run instances that are significantly over-provisioned. Studies consistently show that 30-40% of EC2 instances are oversized by at least one instance size. AWS Compute Optimizer analyzes 14 days of CloudWatch metrics and provides right-sizing recommendations that can reduce costs by 25-40% without impacting performance.

Right-Sizing Process

  1. Collect metrics: Ensure the CloudWatch agent is installed and collecting memory utilization (not included by default). Wait for at least 14 days of data.
  2. Run Compute Optimizer: Review recommendations, focusing on instances marked as “Over-provisioned”
  3. Validate with P99 metrics: Look at the 99th percentile CPU and memory, not just averages. Size for peak with 20-30% headroom.
  4. Resize incrementally: Drop one size at a time (e.g., xlarge to large). Monitor for 1-2 weeks before sizing down further.
  5. Consider horizontal scaling: Instead of one large instance, use an Auto Scaling group with smaller instances for better availability and cost flexibility.
right-sizing-analysis.sh
# Get Compute Optimizer recommendations for over-provisioned instances
aws compute-optimizer get-ec2-instance-recommendations \
  --filters "name=Finding,values=OVER_PROVISIONED" \
  --query 'instanceRecommendations[].{
    InstanceId: instanceArn,
    Current: currentInstanceType,
    Recommended: recommendationOptions[0].instanceType,
    MonthlySavings: recommendationOptions[0].savingsOpportunity.estimatedMonthlySavings.value
  }' \
  --output table

# Install and configure CloudWatch agent for memory metrics
# (Memory utilization is NOT collected by default)
cat > /opt/aws/amazon-cloudwatch-agent/etc/config.json << 'CWCONFIG'
{
  "metrics": {
    "metrics_collected": {
      "mem": {
        "measurement": ["mem_used_percent"],
        "metrics_collection_interval": 60
      },
      "disk": {
        "measurement": ["used_percent"],
        "metrics_collection_interval": 300,
        "resources": ["*"]
      }
    },
    "append_dimensions": {
      "InstanceId": "${aws:InstanceId}",
      "InstanceType": "${aws:InstanceType}"
    }
  }
}
CWCONFIG

# Check 14-day CPU utilization statistics
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUUtilization \
  --dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
  --start-time $(date -u -d '14 days ago' +%Y-%m-%dT%H:%M:%SZ) \
  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
  --period 86400 \
  --statistics Average Maximum p99 \
  --output table

Memory Metrics Are Essential

By default, CloudWatch only collects CPU metrics for EC2 instances. Memory utilization requires the CloudWatch agent. Without memory data, Compute Optimizer recommendations are based solely on CPU, which can lead to undersizing memory-bound workloads. Install the CloudWatch agent on all instances before making right-sizing decisions. Use Systems Manager to deploy the agent across your fleet automatically.

Pricing Models

The instance type is only half the cost equation. The pricing model you choose determines your effective cost per hour. AWS offers four primary pricing models for EC2, each suited to different usage patterns.

Pricing ModelDiscountCommitmentBest For
On-Demand0% (base price)None, pay by the secondVariable workloads, short-lived instances, testing
Compute Savings PlansUp to 66%1 or 3 year $/hour commitmentSteady-state (any instance family, region, OS, or Fargate)
EC2 Instance Savings PlansUp to 72%1 or 3 year (specific family + region)Stable workloads on a known instance family
Reserved InstancesUp to 72%1 or 3 year (specific instance type)Highly predictable workloads (being replaced by Savings Plans)
Spot InstancesUp to 90%None (can be interrupted with 2-min warning)Fault-tolerant: batch processing, CI/CD, data analysis, HPC

Savings Plans Over Reserved Instances

Compute Savings Plans offer similar discounts to Reserved Instances but with much more flexibility. They apply across instance families, sizes, regions, operating systems, tenancies, and even between EC2, Fargate, and Lambda. For most organizations, Compute Savings Plans are the better choice for committed spend because you are not locked into a specific instance type that may change as you right-size or migrate to Graviton.

Spot Instance Best Practices

Spot Instances provide the deepest discounts but can be interrupted with a 2-minute notice when AWS needs the capacity back. To use Spot effectively:

  • Diversify across instance types: Request capacity from multiple instance types and families. Use capacity-optimized allocation strategy to choose the pool with the most available capacity.
  • Use Auto Scaling groups with mixed instances: Combine On-Demand for your baseline with Spot for scaling capacity.
  • Handle interruptions gracefully: Check the instance metadata service for the 2-minute interruption warning. Checkpoint work and deregister from load balancers.
  • Use Spot for stateless workloads: Containers, batch jobs, CI/CD runners, and data processing are ideal. Stateful databases are not.
mixed-instances-asg.yaml
# Auto Scaling group with On-Demand base + Spot scaling
AutoScalingGroup:
  Type: AWS::AutoScaling::AutoScalingGroup
  Properties:
    MinSize: 2
    MaxSize: 20
    VPCZoneIdentifier:
      - !Ref PrivateSubnetA
      - !Ref PrivateSubnetB
    MixedInstancesPolicy:
      InstancesDistribution:
        # Minimum 2 On-Demand instances for baseline
        OnDemandBaseCapacity: 2
        # Scale above baseline with 70% Spot, 30% On-Demand
        OnDemandPercentageAboveBaseCapacity: 30
        # Choose Spot pools with most capacity (fewer interruptions)
        SpotAllocationStrategy: capacity-optimized
      LaunchTemplate:
        LaunchTemplateSpecification:
          LaunchTemplateId: !Ref LaunchTemplate
          Version: !GetAtt LaunchTemplate.LatestVersionNumber
        # Diversify across multiple instance types for Spot
        Overrides:
          - InstanceType: m7g.large
          - InstanceType: m6g.large
          - InstanceType: m7i.large
          - InstanceType: c7g.large
          - InstanceType: c6g.large
          - InstanceType: r7g.medium
AWS Cost Optimization Strategies: Savings Plans and Spot Deep Dive

Specialized Instance Types

Beyond the core families, AWS offers specialized instance types for specific workloads. These instances include custom hardware that provides significant performance advantages over general-purpose instances for their target use cases.

GPU Instances for ML and Graphics

InstanceGPUGPU MemoryBest For
p5.48xlarge8x NVIDIA H100640 GB HBM3Large-scale ML training, LLMs
p4d.24xlarge8x NVIDIA A100320 GB HBM2eML training, HPC simulations
g5.xlarge1x NVIDIA A10G24 GBML inference, graphics rendering
inf2.xlarge1x AWS Inferentia232 GBCost-optimized ML inference
trn1.32xlarge16x AWS Trainium512 GBCost-optimized ML training

Storage Optimized for Databases

I-family instances include high-performance local NVMe SSDs ideal for databases that benefit from low-latency local storage. The i4i instances provide up to 30 TB of NVMe storage with up to 5.5 million random read IOPS. Use these for self-managed databases like Cassandra, Elasticsearch, or ClickHouse that need high I/O performance.

Instance Selection Decision Framework

Use this systematic framework when selecting instance types for a new workload:

  1. Step 1: Start with general purpose. Begin with an M-family instance (m7g.large is a good starting point) and benchmark your workload. Collect at least one week of metrics.
  2. Step 2: Identify the bottleneck. Analyze whether you are CPU-bound (switch to C-family), memory-bound (switch to R-family), I/O-bound (switch to I-family), or GPU-bound (switch to G/P family).
  3. Step 3: Choose the processor. Select Graviton (g suffix) unless x86 is specifically required. Test with both if unsure.
  4. Step 4: Size with headroom. Start one size larger than your benchmark suggests, then right-size down based on production metrics after 2-4 weeks.
  5. Step 5: Choose the pricing model. Use Savings Plans for steady-state capacity, Spot for fault-tolerant scaling, and On-Demand for unpredictable workloads.
  6. Step 6: Implement auto-scaling. Use Auto Scaling groups with mixed instance types and purchase options for the most cost-effective and resilient configuration.

Key Takeaways

Learn the naming convention to quickly identify instance capabilities. Default to Graviton (ARM) for the best price-performance unless your workload specifically requires x86. Use burstable T-instances only for truly variable, light workloads and monitor for surplus credit charges. Right-size continuously using Compute Optimizer and the CloudWatch agent (for memory metrics). Combine Compute Savings Plans with Spot Instances to optimize costs across your fleet. Use Auto Scaling groups with mixed instance types for both cost optimization and resilience. Re-evaluate your instance choices whenever your workload characteristics change or a new instance generation becomes available.

AWS Well-Architected Framework: Performance EfficiencyLambda Performance Tuning: When Serverless vs EC2AWS Networking Deep Dive: Instance Networking and Placement Groups

Key Takeaways

  1. 1EC2 has six major families: General Purpose (M/T), Compute (C), Memory (R/X), Storage (I/D), Accelerated (P/G), and HPC (Hpc).
  2. 2Graviton (ARM64) instances offer 20-40% better price-performance than x86 equivalents.
  3. 3T-series burstable instances are cost-effective for variable workloads with credit monitoring.
  4. 4Instance naming follows the pattern: family + generation + attributes + size (e.g., m7g.xlarge).
  5. 5Right-sizing with Compute Optimizer can reduce costs by 25-50% without performance impact.
  6. 6Match instance type to workload profile: CPU-bound, memory-bound, or I/O-bound.

Frequently Asked Questions

What do EC2 instance type names mean?
The format is family + generation + attributes + size. For example, m7g.xlarge: m = general purpose, 7 = 7th generation, g = Graviton, xlarge = size. Letters like 'i' mean Intel, 'a' means AMD, 'n' means enhanced networking.
Should I use Graviton instances?
Yes, for most workloads. Graviton3 instances offer up to 40% better price-performance than comparable x86 instances. Most Linux software runs on ARM64. Check compatibility first for Windows workloads or software with x86 dependencies.
What is the difference between T, M, and C instances?
T-series are burstable (good for variable workloads, cheapest). M-series are general purpose with fixed performance (balanced CPU/memory). C-series are compute-optimized with high CPU-to-memory ratio (good for batch processing, encoding).
How do I choose the right instance size?
Start with a medium or large instance, monitor CPU, memory, and network utilization for a week, then right-size. Use AWS Compute Optimizer for data-driven recommendations. Over-provisioning wastes money; under-provisioning hurts performance.
What are Spot Instances and when should I use them?
Spot Instances offer up to 90% discount but can be interrupted with 2-minute notice. Use them for fault-tolerant workloads: batch processing, CI/CD, data analysis, and stateless containers. Combine with On-Demand for a cost-effective mix.

Written by CloudToolStack Team

Cloud engineers and architects with hands-on experience across AWS, Azure, and GCP. We write guides based on real-world production patterns, not just documentation rewrites.

Disclaimer: This guide is for educational purposes. Cloud services change frequently; always refer to official documentation for the latest information. AWS, Azure, and GCP are trademarks of their respective owners.