Skip to content

EC2 Instance Types & Purchasing Options

Decode the instance-type naming scheme and choose a purchasing option that can cut compute cost 40-90% without touching your architecture.

EC2Auto ScalingSpot
3 min readBeginner
Lab time: 15-20 min
RR

Ranjith R

Linux SysAdmin & Cloud Engineer

Published July 1, 2026Updated July 6, 2026
Share
Section 01

Prerequisites

  • An AWS account
  • Basic familiarity with launching an EC2 instance from the console or CLI
Section 02

What You'll Learn

  • Decode an instance type string into family, generation, capability, and size
  • Match a workload to the right instance family (general purpose, compute, memory, storage optimized)
  • Compare On-Demand, Reserved Instances, Savings Plans, and Spot on cost and risk
  • Identify workloads where Spot is safe to use and where it isn't
Section 03

Theory

Every EC2 instance type name encodes four pieces of information in a fixed pattern: family, generation, optional capability letter, and size.

m6g.xlarge decoded: general-purpose family, 6th generation, Graviton (ARM) processor, xlarge size

Instance families by workload

Family prefixOptimized forExample use case
t, mGeneral purpose (balanced CPU:RAM)Web servers, small databases
cCompute optimized (high CPU:RAM ratio)Batch processing, video encoding
r, xMemory optimized (high RAM:CPU ratio)In-memory caches, large databases
i, dStorage optimized (high-speed local NVMe)Data warehousing, distributed filesystems
g, pAccelerated computing (GPU)ML training/inference, rendering

Purchasing options

On-Demand — pay per second, no commitment, highest unit price. Reserved Instances — commit to a specific instance family/region for 1 or 3 years for up to ~72% off, fairly rigid. Savings Plans — commit to a dollar/hour spend instead of a specific instance, discount applies automatically across EC2/Fargate/Lambda usage, more flexible than RIs. Spot — bid on spare AWS capacity for up to ~90% off, but the instance can be reclaimed with a 2-minute warning at any time.

Section 04

Architecture

A common cost-optimized production pattern splits a fleet across purchasing options: baseline steady-state capacity on a Savings Plan, burst/scale-out capacity on-demand, and fully interruption- tolerant batch workloads on Spot — often coordinated through a single Auto Scaling Group with mixed instance policies so AWS automatically fills capacity across whichever option is available.

Section 05

Hands-On Lab

Compare pricing and launch a Spot instance from the CLI:

# List current On-Demand prices for a family in your region (requires the Price List API / a tool like ec2-instances.info for a quick read)
aws ec2 describe-instance-types --instance-types m6i.large c6i.large r6i.large \
  --query 'InstanceTypes[].[InstanceType,VCpuInfo.DefaultVCpus,MemoryInfo.SizeInMiB]' \
  --output table

# Request a Spot instance directly (note: request can be denied if no capacity is available)
aws ec2 run-instances \
  --image-id ami-0123456789abcdef0 \
  --instance-type c6i.large \
  --instance-market-options '{"MarketType":"spot","SpotOptions":{"MaxPrice":"0.05","SpotInstanceType":"one-time"}}' \
  --key-name my-key \
  --count 1

# Check Spot interruption history/likelihood before committing a workload to it
aws ec2 describe-spot-price-history \
  --instance-types c6i.large \
  --product-descriptions "Linux/UNIX" \
  --max-results 5
Section 07

Best Practices

Right-size before committing to a discount

A 3-year Reserved Instance on an over-provisioned instance locks in waste for three years. Use CloudWatch utilization data (or Compute Optimizer's recommendations) to right-size first, then commit.

Use Spot for anything stateless and restartable

CI/CD build agents, batch jobs, and horizontally-scaled stateless web tiers behind a load balancer tolerate Spot interruption well — the Auto Scaling Group just replaces the reclaimed instance.
Section 08

Common Mistakes

Putting a stateful database on Spot

A Spot interruption gives only a 2-minute warning — enough time to drain a stateless web server, not enough to safely fail over a single-instance database with no replica. Keep primary databases on On-Demand or Reserved capacity.

Comparing instance types by vCPU count alone

A vCPU on a compute-optimized c-family instance and a burstable t-family instance aren't equivalent — t-family instances use CPU credits and throttle under sustained load. Compare using actual benchmarks or AWS's published relative performance, not vCPU count alone.
Section 09

Troubleshooting

Spot request stuck in "pending": the requested instance type/AZ combination has no spare capacity right now — check describe-spot-price-history for that type across multiple AZs, or use Spot Fleet / Auto Scaling with multiple instance types to widen the pool of acceptable capacity.

Reserved Instance not applying its discount:RIs match on instance family, region, tenancy, and platform — a mismatch on any of these (e.g. reserving in us-east-1 but running in us-east-2, or a size mismatch with regional RIs, which do allow size-flexibility within the same family/generation) silently leaves the RI unused while you're billed On-Demand.

Section 10

Interview Questions

A Reserved Instance commits to a specific instance family/size/region/OS for 1 or 3 years in exchange for a discount, and is fairly rigid (though convertible RIs allow some flexibility). A Savings Plan commits to a dollar-per-hour spend instead of a specific instance configuration, automatically applying the discount to any matching usage (EC2, Fargate, and Lambda for Compute Savings Plans) — making it more flexible when workloads or instance types are expected to change over the commitment period.
See all 20 AWS interview questions
FAQ

Frequently Asked Questions

It's a multiplier on the base 'large' size within that family — xlarge, 2xlarge, 4xlarge etc. roughly double vCPU and memory at each step, letting you scale vertically within the same family without changing architecture.
Section 12

Summary

Instance type names encode family, generation, capability, and size in a fixed pattern; match the family to the workload's actual bottleneck (CPU, memory, storage, or GPU); and layer purchasing options — Savings Plans for steady-state, On-Demand for burst, Spot for interruption-tolerant work — to cut compute cost without changing architecture.

Related Articles

Related Projects

Related Interview Questions

Related Roadmap Topics