EC2 Pricing: On-Demand, Reserved, Spot, and Savings Plans — What to Pick and Why
The same m5.xlarge in us-east-1 costs 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:
- Development and testing environments with irregular schedules
- Workloads that run for hours or days but not continuously
- New applications where you haven’t determined the right instance type yet
- Traffic spikes that exceed your reserved capacity
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 232 — $595 saved per instance per year.
# Standard On-Demand launch — no additional billing configurationaws ec2 run-instances \ --image-id ami-0c02fb55956c7d316 \ --instance-type m5.large \ --subnet-id subnet-0a1b2c3dReserved 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
| Option | Upfront | Monthly | 1-Year m5.large | 3-Year m5.large |
|---|---|---|---|---|
| All Upfront | Full cost now | $0 | $440 | $253 |
| Partial Upfront | Half now | Rest monthly | ~$467 | ~$270 |
| No Upfront | $0 | Monthly | ~$526 | ~$316 |
| On-Demand (reference) | $0 | Pay 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:
- Two
m5.largeinstances (factor 4 each) - Half of one
m5.2xlarge(factor 16)
This flexibility makes it less critical to buy RIs at exactly the right size. Buy at the family level, let AWS apply the coverage.
# View available Reserved Instance offeringsaws ec2 describe-reserved-instances-offerings \ --instance-type m5.large \ --product-description "Linux/UNIX" \ --offering-class standard \ --query 'ReservedInstancesOfferings[?Duration==`31536000`].[OfferingType,RecurringCharges]' \ --output tableSavings 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:
- Any EC2 family, size, region, tenancy, and OS
- AWS Fargate compute charges
- AWS Lambda compute charges
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.
# Check existing Savings Plan commitmentsaws savingsplans describe-savings-plans \ --query 'savingsPlans[*].[savingsPlanType,commitment,state,end]' \ --output table
# See how much of your Savings Plan commitment is being usedaws savingsplans describe-savings-plans-coverage \ --time-period Start=2024-01-01,End=2024-01-31Savings 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 payRunning Spot Safely
Never depend on a single Spot Instance or a single instance type in a single AZ. Diversification reduces interruption probability:
# Create a Spot fleet across multiple instance types and AZsaws 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=diversifiedThe 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:
# Check for interruption notice from within the instancecurl -s http://169.254.169.254/latest/meta-data/spot/termination-time# Returns nothing if no interruption, or a timestamp if interruptedWell-designed Spot workloads respond to this by checkpointing state to S3 or EBS before the instance terminates.
Workloads suited to Spot:
- ML training jobs that checkpoint to S3 every N minutes
- Batch ETL pipelines reading from SQS or S3
- CI/CD build workers (builds are stateless)
- Scientific simulations that can resume from checkpoints
- Web crawlers and data collection jobs
Workloads that should not use Spot:
- Primary databases without replica protection
- Single-instance services with no failover
- Jobs that take hours but cannot checkpoint
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:
- Bring your own software licenses (Windows Server, SQL Server, RHEL) that charge per-socket or per-core — Dedicated Hosts let you maximise license utilisation
- Compliance requirements that prohibit sharing hardware with other AWS tenants
- Access to the specific host to satisfy software audits
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/7AWS 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.