Cloud  /  AWS

AWS Amazon Web Services 61 guides · updated 2026

Hands-on guides to compute, storage, databases, networking, and serverless on the world's most widely adopted cloud platform.

EC2 Pricing: On-Demand, Reserved, Spot, and Savings Plans — What to Pick and Why

The same m5.xlarge in us-east-1 costs 0.192/hronOnDemandand0.192/hr on On-Demand and 0.048/hr on a 3-year Reserved Instance — a four-fold difference. For a fleet of 20 instances running constantly, that gap is $24,000 per year. Understanding which model to use and when is one of the highest-ROI cloud cost decisions you can make.

┌───────────────────────────────────────────────────────────────────────┐
│ EC2 Pricing Model Comparison │
│ │
│ Model Discount Commitment Interruptible? │
│ ───────────────────────────────────────────────────────────────── │
│ On-Demand 0% None No │
│ Reserved (RI) up to 72% 1 or 3 years No │
│ Savings Plans up to 66% 1 or 3 years No │
│ Spot up to 90% None Yes (2-min warning) │
│ Dedicated Host ~Same as RI 1 or 3 years No │
└───────────────────────────────────────────────────────────────────────┘

On-Demand: Full Price, Full Flexibility

On-Demand billing starts the second your instance boots and stops the second it terminates, rounded up to the nearest second for Linux (Windows bills per hour). No contracts, no upfront payments, no penalties.

When On-Demand is the right choice:

When On-Demand is the wrong choice: Running On-Demand instances for a year without a savings plan is almost always a budgeting mistake. An m5.large at On-Demand for 8,760 hours costs 827.Thesameinstanceona3yearNoUpfrontReservedInstancecosts827. The same instance on a 3-year No Upfront Reserved Instance costs 232 — $595 saved per instance per year.

Terminal window
# Standard On-Demand launch — no additional billing configuration
aws ec2 run-instances \
--image-id ami-0c02fb55956c7d316 \
--instance-type m5.large \
--subnet-id subnet-0a1b2c3d

Reserved Instances: Discount Through Commitment

A Reserved Instance is a billing discount, not an actual server. You commit to an instance family, region, and OS for 1 or 3 years. When a matching On-Demand instance runs in your account, AWS applies the discount automatically. If no matching instance is running, the RI charge still applies.

Standard vs Convertible

Standard RI: Highest discount — up to 72% on 3-year All Upfront. You lock in the instance family, generation, OS, and region. Cannot switch families during the term. Can be listed on the AWS Marketplace if your plans change.

Convertible RI: Lower discount — up to 54%. You can exchange it for a different family, generation, OS, or tenancy at any point. Cannot sell on the Marketplace. Better if you expect architectural changes during the commitment period.

Payment Options

OptionUpfrontMonthly1-Year m5.large3-Year m5.large
All UpfrontFull cost now$0$440$253
Partial UpfrontHalf nowRest monthly~$467~$270
No Upfront$0Monthly~$526~$316
On-Demand (reference)$0Pay as you go$827$827

All Upfront saves the most. No Upfront requires no capital but still beats On-Demand by 36% on a 1-year commitment.

Instance Size Flexibility

Within the same instance family and region, a Standard RI covers different sizes proportionally. One m5.xlarge RI (normalisation factor 8) can cover:

This flexibility makes it less critical to buy RIs at exactly the right size. Buy at the family level, let AWS apply the coverage.

Terminal window
# View available Reserved Instance offerings
aws ec2 describe-reserved-instances-offerings \
--instance-type m5.large \
--product-description "Linux/UNIX" \
--offering-class standard \
--query 'ReservedInstancesOfferings[?Duration==`31536000`].[OfferingType,RecurringCharges]' \
--output table

Savings Plans: Commitment Without Instance Lock-In

Savings Plans commit to a minimum spend in dollars per hour rather than to specific instance types. The discount applies automatically to matching usage.

Compute Savings Plans

The most flexible variant. Your commitment covers:

If your team migrates from m5 in us-east-1 to m7g in eu-west-1, or moves some workloads from EC2 to Fargate, the Compute Savings Plan automatically applies. Discount: up to 66%.

EC2 Instance Savings Plans

Commit to a specific instance family within a specific region (e.g., m-family in us-east-1). Higher discount — up to 72%, matching Standard RI — but no flexibility across families or regions.

Terminal window
# Check existing Savings Plan commitments
aws savingsplans describe-savings-plans \
--query 'savingsPlans[*].[savingsPlanType,commitment,state,end]' \
--output table
# See how much of your Savings Plan commitment is being used
aws savingsplans describe-savings-plans-coverage \
--time-period Start=2024-01-01,End=2024-01-31

Savings Plans vs Reserved Instances for most teams: If you are confident about your instance family for 3 years, Standard RIs give maximum savings. If you expect architectural evolution — moving to containers, changing regions, or adopting Graviton — Compute Savings Plans are more resilient to change.

Spot Instances: Cheapest but Interruptible

Spot Instances run on AWS spare EC2 capacity at up to 90% off On-Demand pricing. The market price fluctuates based on available capacity. When AWS needs the capacity back, it sends a 2-minute interruption notice and then terminates your instance.

Spot price example for m5.large (us-east-1):
On-Demand: $0.096/hr
Spot: $0.028/hr (about 70% savings)
Market fluctuates; you set a max price you're willing to pay

Running Spot Safely

Never depend on a single Spot Instance or a single instance type in a single AZ. Diversification reduces interruption probability:

Terminal window
# Create a Spot fleet across multiple instance types and AZs
aws ec2 create-fleet \
--type maintain \
--target-capacity-specification TotalTargetCapacity=10,DefaultTargetCapacityType=spot \
--launch-template-configs '[
{"LaunchTemplateSpecification": {"LaunchTemplateName": "my-template", "Version": "$Latest"},
"Overrides": [
{"InstanceType": "m5.large", "SubnetId": "subnet-1a"},
{"InstanceType": "m5a.large", "SubnetId": "subnet-1a"},
{"InstanceType": "m4.large", "SubnetId": "subnet-1a"},
{"InstanceType": "m5.large", "SubnetId": "subnet-1b"},
{"InstanceType": "m5a.large", "SubnetId": "subnet-1b"}
]}
]' \
--spot-options AllocationStrategy=diversified

The diversified allocation strategy spreads instances across multiple pools, reducing the probability that all your capacity gets interrupted simultaneously.

Interruption Handling

When a Spot Instance receives an interruption notice, the instance metadata endpoint returns the termination time:

Terminal window
# Check for interruption notice from within the instance
curl -s http://169.254.169.254/latest/meta-data/spot/termination-time
# Returns nothing if no interruption, or a timestamp if interrupted

Well-designed Spot workloads respond to this by checkpointing state to S3 or EBS before the instance terminates.

Workloads suited to Spot:

Workloads that should not use Spot:

Dedicated Hosts: Your Own Physical Server

Dedicated Hosts give you a physical EC2 server dedicated to your account. You can see the physical host, its socket and core count, and control instance placement on it.

Why use Dedicated Hosts:

Dedicated Hosts cost per host-hour (the specific rate depends on the instance family). 1-year and 3-year commitments are available.

Dedicated Instances are simpler: instances run on hardware not shared with other AWS accounts, but you do not see or control the host. No licensing benefit, but physical isolation for compliance.

A Practical Cost Strategy

Fleet composition for a typical production application:
Base load (predictable, always-on):
→ Reserved Instances or EC2 Instance Savings Plans
→ Cover the minimum number of instances that always run
→ Target 80-90% of baseline with 1-year commitment
Variable load (spiky, autoscaled):
→ On-Demand instances handled automatically by Auto Scaling Group
→ Scaling adds On-Demand; scaling removes them when done
Batch and asynchronous workloads:
→ Spot Instances via Auto Scaling Group with mixed instance policy
→ 70% Spot, 30% On-Demand as fallback
Development environments:
→ On-Demand, turned off outside business hours via Lambda scheduler
→ Savings: ~65% vs running 24/7

AWS Cost Explorer has a recommendation tab for Reserved Instances and Savings Plans. After 30 days of On-Demand usage, it shows exactly which commitments would have saved money based on actual utilisation patterns.

Common Interview Questions

Q: If you have a 3-year Standard RI for m5.large and switch your workload to m6i.large, does the RI still apply? No. Standard RIs lock in the exact instance family and generation. An m5.large RI does not cover m6i.large. Convertible RIs can be exchanged for the new family. This is one reason Savings Plans are often preferable — a Compute Savings Plan covers both m5 and m6i automatically.

Q: What happens when a Spot Instance is interrupted and you have active processing? AWS sends a 2-minute notice via instance metadata and EventBridge. You have 2 minutes to checkpoint work, drain queues, deregister from load balancers, and handle shutdown gracefully. After the 2-minute window, the instance is terminated. Properly designed workloads either checkpoint frequently or are inherently idempotent so interrupted jobs can restart cleanly.

Q: Can you apply both Reserved Instances and Savings Plans simultaneously? Yes. Reserved Instances (and EC2 Instance Savings Plans) are applied first. Compute Savings Plans then apply to any remaining On-Demand usage after RI coverage is exhausted. You would not typically buy both for the same capacity, but combining them is valid.

Q: What is the difference between Dedicated Host and Dedicated Instance? Dedicated Hosts give you visibility into and control over a specific physical server, enabling per-socket or per-core licensing. Dedicated Instances just ensure physical hardware is not shared with other accounts, with no host-level visibility. Dedicated Hosts cost per host; Dedicated Instances cost per instance with a small per-region surcharge.