Understanding EC2 pricing
Amazon EC2 charges for compute capacity based on the instance type, region, operating system, and how long the instance runs. Unlike serverless services like Lambda, EC2 instances are billed for the entire time they are in the running state — even if idle. Choosing the right instance type and pricing model has the biggest impact on your bill.
- Instance type: Determines vCPU count, memory, network performance, and base hourly rate. Instance families are optimised for different workload profiles — T-series for burstable work, M-series for general balanced workloads, C-series for CPU-heavy tasks, and R-series for memory-intensive applications.
- Region: Prices vary by AWS region. us-east-1 (N. Virginia) and us-west-2 (Oregon) are typically the cheapest. Regions in São Paulo, Tokyo, and London carry premiums of 10–57% over us-east-1.
- Operating system: Linux instances cost less than Windows because Windows requires a license fee. The premium varies by instance size. This calculator applies an approximate +35% for Windows.
- Pricing model: On-demand offers full flexibility with the highest per-hour rate. Reserved Instances commit to 1 or 3 years in exchange for up to 57% savings. Spot Instances use spare AWS capacity at up to 90% discount but can be interrupted.
- EBS storage: Most EC2 instances use EBS volumes for persistent storage. The default gp3 volume type costs $0.08/GB/month. Storage is billed separately from compute and continues while the instance is stopped.
EC2 instance families explained
AWS groups EC2 instances into families based on their intended workload. Picking the right family avoids over-spending on resources your application does not need.
- T-series (T3, T4g) — Burstable General Purpose: Low baseline CPU with burst credits. Best for variable-load workloads like dev environments, small websites, and microservices with occasional spikes. The cheapest option for intermittent workloads.
- M-series (M6i, M7g) — General Purpose: Balanced CPU, memory, and networking. The default choice for web servers, application servers, and small databases. M7g (Graviton3) costs roughly 15% less than M6i for similar performance.
- C-series (C6i, C7g) — Compute Optimized: Higher CPU-to-memory ratio and faster processors. Best for batch processing, media transcoding, scientific computing, and high-traffic web servers where CPU is the bottleneck.
- R-series (R6i, R7g) — Memory Optimized: Large memory allocations relative to CPU. Best for in-memory databases (Redis, Memcached), real-time big data processing, and SAP HANA workloads.
Graviton instances: lower cost, same performance
AWS Graviton processors (ARM-based, designed by AWS) power the T4g, M7g, C7g, and R7g instance families. Graviton2 and Graviton3 instances are typically 20% cheaper than equivalent x86 instances (T3, M6i, C6i, R6i) for the same workload performance.
Graviton instances require applications compiled for ARM64. Most popular Linux workloads — including Python, Node.js, Java, Go, Docker containers, and common databases — run on Graviton without modification. Check your application's dependencies before migrating.
Graviton instances do not support Windows. If you need Windows, use the x86 instance families (T3, M6i, C6i, R6i).
Example cost scenarios
These worked examples show how EC2 costs add up at different scales. All use us-east-1, Linux, and 730 hours (24/7 running).
- Instance
- t3.medium
- vCPU / RAM
- 2 vCPU · 4 GiB
- Region
- us-east-1
- Pricing
- On-Demand
- Hours / month
- 160 (8hrs/day)
- EBS
- 20 GB gp3
| Line item | Cost |
|---|---|
| Compute $0.0416 × 160 hr | $6.66 |
| EBS gp3 20 GB × $0.08 | $1.60 |
Running dev instances only during business hours (8 hrs/day) cuts compute costs by 78% versus 24/7.
- Instance
- m6i.xlarge
- vCPU / RAM
- 4 vCPU · 16 GiB
- Region
- us-east-1
- Pricing
- Reserved 1yr
- Hours / month
- 730 (24/7)
- EBS
- 100 GB gp3
| Line item | Cost |
|---|---|
| Compute $0.192 × 0.62 × 730 | $86.90 |
| EBS gp3 100 GB × $0.08 | $8.00 |
| Savings vs on-demand | $53.10 (38%) |
Switching from on-demand to Reserved 1yr saves $53/month ($636/year) on a single m6i.xlarge.
- Instance
- c6i.2xlarge × 10
- vCPU / RAM
- 8 vCPU · 16 GiB
- Region
- us-east-1
- Pricing
- Spot (estimate)
- Hours / month
- 730 (24/7)
- EBS
- 50 GB gp3 each
| Line item | Cost |
|---|---|
| Compute $0.34 × 0.30 × 730 × 10 | $745.20 |
| EBS gp3 50 GB × $0.08 × 10 | $40.00 |
| Savings vs on-demand | $1,743/mo (70%) |
Spot is ideal for fault-tolerant batch jobs. On-demand equivalent would be ~$2,534/month. Implement checkpointing to handle interruptions.
Choosing the right pricing model
The biggest lever for reducing EC2 costs is the pricing model. Here is how to choose.
- On-Demand: Use for workloads you cannot predict, short-lived jobs, experiments, or anything that might run for less than a month. No commitment, highest per-hour rate.
- Reserved Instances (1yr or 3yr): Use for stable, predictable production workloads that run 24/7. The break-even point versus on-demand is around 4–5 months of continuous use. After that, Reserved Instances save money every month.
- Spot Instances: Use for fault-tolerant batch workloads, stateless web tiers behind a load balancer, or HPC jobs. Spot capacity can be reclaimed by AWS with 2 minutes notice. Implement checkpointing or use Auto Scaling to replace interrupted Spot instances automatically.
Frequently asked questions about EC2 billing
How does EC2 on-demand pricing work?
EC2 on-demand instances are billed per second with a 60-second minimum. The price depends on the instance type, region, and operating system. Instances are billed from the moment they enter the running state until they are terminated. Stopping an instance stops compute billing, but EBS volumes continue to be billed while stopped.
What is the difference between stopping and terminating an EC2 instance?
Stopping an instance suspends compute billing but keeps the EBS root volume (you continue to pay for storage). Terminating an instance deletes the instance and its root volume (unless the volume is configured to persist). Stop instances when you want to resume them later; terminate when you are done with them entirely.
How much can I save with Reserved Instances?
With a 1-year No Upfront reservation, savings average around 38% versus on-demand. With a 3-year No Upfront reservation, savings average around 57%. Paying all upfront (instead of No Upfront) increases savings by a few more percentage points but requires capital outlay. Reserved Instance savings are realised as a billing credit applied automatically when you run matching instances.
What happens if a Spot Instance is interrupted?
AWS provides a 2-minute interruption notice when it needs to reclaim Spot capacity. Your instance is given a signal so you can checkpoint state, drain connections, or gracefully shut down. You are not charged for the partial hour in which the instance is interrupted by AWS. Design Spot workloads to be stateless or to checkpoint frequently so interruptions are recoverable.
Are Graviton instances worth the migration effort?
For most Linux workloads, yes. Graviton2 and Graviton3 instances typically cost 20% less for the same performance as equivalent x86 instances. Most popular runtimes (Python, Node.js, Java, Go) and databases (PostgreSQL, MySQL, Redis) support ARM64 natively. Docker images with multi-arch support run on Graviton without rebuilding. The migration is usually a configuration change, not a code change.
What costs are not included in this calculator?
This calculator covers EC2 compute and EBS gp3 storage. It does not include: data transfer (egress) costs, which can be significant for internet-facing services; EBS snapshot storage in S3; Elastic IP charges when not attached to a running instance; NAT Gateway costs for private subnet traffic; Classic or Application Load Balancer charges; or CloudWatch monitoring beyond the basic tier. Use the AWS Pricing Calculator for a full estimate.