# On-demand, Committed and Spot Capacity — Cost & Capacity Estimation

Source: https://www.skillbyai.com/en/capacity-estimation/ce-pricing-models

> Choose between on-demand, committed-use and spot or preemptible capacity based on load shape and risk.

## Match the purchase model to the load curve

Cloud providers sell the same compute in several ways. **On-demand** is pay-as-you-go with no commitment and the highest unit price; it suits unpredictable or short-lived load. **Committed use** (reserved instances, savings plans, committed-use discounts; names vary by provider) trades a one- or multi-year commitment for a lower rate; it suits the steady baseline you are confident will exist. **Spot or preemptible** capacity is spare capacity sold at a deep discount that the provider can reclaim at short notice; it suits fault-tolerant, interruptible work such as batch jobs, CI runners and stateless workers behind a queue. A common strategy is layered: cover the always-on baseline with commitments, the daily peak with autoscaled on-demand, and interruptible work with spot. The capacity estimate tells you how big each layer should be; committing to more than your real baseline wastes the discount.

## Blended cost of a layered plan

All rates below are made-up placeholders for practice; always take real rates from your provider's current pricing page.

```python
HOURS = 730
on_demand_rate = 0.20
committed_rate = on_demand_rate * 0.6   # assumed 40% discount
baseline_servers = 20                   # always on
peak_extra_avg = 8                      # average extra servers from autoscaling

all_on_demand = (baseline_servers + peak_extra_avg) * HOURS * on_demand_rate
layered = (baseline_servers * HOURS * committed_rate
           + peak_extra_avg * HOURS * on_demand_rate)
print(f"all on-demand: ${all_on_demand:,.0f}")
print(f"layered      : ${layered:,.0f}")
print(f"saving       : {1 - layered / all_on_demand:.0%}")
```

Output:

```
all on-demand: $4,088
layered      : $2,920
saving       : 29%
```

## Never put the only database replica on spot

Spot instances can disappear with little warning. Use them where losing a node means a retry, not lost data or an outage.

**Quiz:** Which workload fits spot or preemptible instances best?

- [x] A stateless video-transcoding worker pulling jobs from a queue
- [ ] The single primary database
- [ ] A license server that must never restart
- [ ] A long-lived WebSocket gateway with no reconnection logic

*Answer:* A stateless video-transcoding worker pulling jobs from a queue. Queue-driven, stateless, retryable work tolerates interruptions. The others suffer directly when a node is reclaimed.
