DevOps Peach

AWS Basics · Compute with Amazon EC2 · Lesson 5 of 5

EC2 Pricing Models

Choose On-Demand, Savings Plans, Reserved, Spot, or Dedicated for a workload.

Practice interactively →

Choose by commitment and interruption tolerance

On-Demand has no commitment and fits new or variable demand. Savings Plans commit to a dollar amount of usage per hour for one or three years and are more flexible than Reserved Instances. Reserved Instances are a billing and capacity benefit for matching usage, not a separate machine type.

flowchart LR
  A{"Can it be<br/>interrupted?"} -- "yes" --> S["Spot<br/>up to ~90% off"]
  A -- "no" --> B{"Steady usage<br/>1 or 3 years?"}
  B -- "no" --> O["On-Demand<br/>pay per second"]
  B -- "yes" --> C["Savings Plans<br/>or Reserved"]
  L{"License or<br/>isolation rule?"} -- "yes" --> D["Dedicated Host<br/>or Instance"]
  %% step A: First ask whether the work survives being stopped at short notice.
  %% step S: Batch jobs, CI runners and stateless workers fit Spot.
  %% step B: For always-on work, ask whether usage is steady and predictable.
  %% step O: New, spiky or short-lived workloads stay On-Demand.
  %% step C: A steady baseline gets a commitment discount.
  %% step L: Per-socket licences or strict isolation rules need dedicated hardware.
  %% step D: Dedicated options cost more and are chosen for compliance, not price.

The models

Model Commitment Discount vs On-Demand Interruptible Good for
On-Demand None — No Unknown or spiky demand, tests
Compute Savings Plan $/hour, 1 or 3 years Up to about 66% No Any instance family, Region, Fargate, Lambda
EC2 Instance Savings Plan $/hour for one family in one Region Up to about 72% No Stable fleets of one family
Reserved Instance Specific type/Region, 1 or 3 years Up to about 72% No Steady usage; zonal RIs also reserve capacity
Spot None Up to about 90% Yes, 2-minute notice Batch, CI, big data, fault-tolerant work
Dedicated Host Per host — No Bring-your-own-license per socket/core

Discount figures are AWS's published maximums; real savings depend on type, term, and payment option (all upfront, partial, no upfront).

Spot in practice

Spot uses spare capacity at deep discounts, but AWS can reclaim it; workloads receive an interruption notice roughly two minutes ahead, readable from instance metadata or EventBridge. It fits batch, CI workers, and checkpointed distributed processing, but not a single production database. Improve resilience by allowing many instance types and AZs in an Auto Scaling group with a capacity-optimized allocation strategy.

Other ways to save

Dedicated Hosts or Instances address special isolation or licensing requirements and usually cost more. A system can mix models: committed baseline, On-Demand bursts, and Spot batch work.

Command Purpose
aws ec2 describe-spot-price-history --instance-types c7g.large --product-descriptions Linux/UNIX View Spot price history
aws ec2 describe-instance-type-offerings ... See where a type is offered
aws ce get-savings-plans-purchase-recommendation ... Get a Savings Plans recommendation

Traps: running a single production database on Spot; thinking a Reserved Instance is a machine you launch; committing to three years before rightsizing.

Practice interactively →