Sub topic 11
Choosing a Pricing Model for Each Workload
This chapter turns the pricing models into a decision. It assumes you know what On-Demand, Reserved Instances (RIs), Savings Plans, and Spot Instances are, and that you understand instance families, Regions, and Availability Zones. You will classify a workload by three traits and pick a model from the result.
The three questions
Every pricing choice comes down to three traits of the workload:
- Steadiness. Does the workload run at a predictable level for a year or more?
- Flexibility. Can it change instance family, size, Region, or compute service over the commitment term?
- Fault tolerance. Can it lose an instance with two minutes of warning and keep going?
Steadiness decides whether a commitment is safe. Flexibility decides which commitment type fits. Fault tolerance decides whether Spot is allowed at all.
| Trait | Answer | What it points to |
|---|---|---|
| Steadiness | Steady for 1 to 3 years | Savings Plans or RIs |
| Steadiness | Spiky, new, or short-lived | On-Demand or Spot |
| Flexibility | Likely to change families, Regions, or services | Compute Savings Plans or Convertible RIs |
| Flexibility | Fixed family and Region | EC2 Instance Savings Plans or Standard RIs |
| Fault tolerance | Tolerates interruption | Spot |
| Fault tolerance | Cannot tolerate interruption | On-Demand, RIs, or Savings Plans |
Walking the decision
Start with fault tolerance, because it is the only trait that can rule a model out completely. A workload that cannot survive an interruption must not run on Spot, however cheap it is.
The flow is a starting point. Real workloads often split into parts, and each part gets its own answer. A web tier might have a steady floor that suits a commitment and a variable top that suits Spot.
Matching common workloads
Steady production services
A database server or an always-on API that runs 24 hours a day is the classic commitment case. It cannot be interrupted, and its usage is predictable.
- If you might migrate to a newer instance family or move some work to AWS Fargate or AWS Lambda, choose a Compute Savings Plan. It applies across families, Regions, and compute services.
- If you are sure the workload stays in one family and Region, an EC2 Instance Savings Plan gives a deeper discount for that narrower promise.
- Choose an RI instead of a Savings Plan when you need its specific properties, such as a zonal RI that reserves capacity in one Availability Zone.
Batch and data processing
Nightly ETL jobs, rendering, and analytics are usually fault tolerant. They can checkpoint progress and rerun a failed piece. These are strong Spot candidates. If the jobs run on a fixed schedule for years, you can still cover a small steady portion with a commitment, but most of the savings come from Spot.
Stateless web and container fleets
Fleets behind a load balancer tolerate losing one instance because other instances take the traffic. This is where a mixed approach works best: a baseline of On-Demand capacity that commitments cover, plus Spot for growth. The Auto Scaling group policy below does exactly that.
{
"LaunchTemplate": {
"LaunchTemplateSpecification": {
"LaunchTemplateName": "web-template",
"Version": "$Latest"
},
"Overrides": [
{ "InstanceType": "c5.large" },
{ "InstanceType": "c5a.large" },
{ "InstanceType": "m5.large" }
]
},
"InstancesDistribution": {
"OnDemandBaseCapacity": 2,
"OnDemandPercentageAboveBaseCapacity": 0,
"SpotAllocationStrategy": "price-capacity-optimized"
}
}OnDemandBaseCapacity of 2 keeps two On-Demand instances running at all times. Your commitment discounts apply to those. A percentage of 0 above the base sends all additional capacity to Spot. Three instance types let Spot draw from several capacity pools.
Development, test, and short experiments
Usage here is irregular, and a one-year commitment would likely go unused. Use On-Demand, and stop instances outside working hours. If the environment tolerates interruptions, use Spot. Do not commit to this kind of load.
New or uncertain workloads
If you do not know how much capacity a new application needs, run it On-Demand first. Measure for a few weeks. Commit only to the usage you have seen. A commitment made on a forecast is a guess, and the bill for a wrong guess lasts for the whole term.
Workloads that cannot use Spot
Some workloads fail the fault-tolerance test even when they look flexible:
- A single-instance database with local state and no replica.
- A long job that cannot checkpoint, where an interruption throws away hours of work.
- A licensed application tied to specific instances.
- A latency-sensitive service with no spare capacity to absorb a lost node.
For these, the choice is among On-Demand, RIs, and Savings Plans. Fixing the fault tolerance is sometimes cheaper than paying more for the compute. Adding checkpointing to a batch job can move it from On-Demand to Spot and cut its cost sharply.
Common errors
- Committing to the peak. A commitment is billed every hour whether or not you use it. If you commit to peak usage, you pay for idle commitment during quiet hours. Commit to the floor, the level your usage rarely drops below.
- Choosing Standard RIs or EC2 Instance Savings Plans for a workload that will change. The deeper discount does not help if you migrate families and the commitment no longer matches.
- Running Spot with a single instance type. One pool means one point of failure. Diversify across types and Availability Zones.
- Ignoring capacity needs. Savings Plans lower price but do not reserve capacity. If a workload must be able to launch in a specific Availability Zone during a shortage, you need a zonal RI or a capacity reservation.
- Treating the choice as permanent. Usage changes. Review it regularly using coverage and utilization data, covered in the next chapters.
Worked example
A company runs four workloads in one Region:
| Workload | Behavior | Interruption tolerance | Choice |
|---|---|---|---|
| Order database | Runs 24/7, one family | None | EC2 Instance Savings Plan |
| Web fleet | Floor of 10 instances, peaks at 40 | High | Commitment for the floor, Spot for the rest |
| Nightly report job | Runs 3 hours per night | High, checkpoints | Spot |
| Staging environment | Used on weekdays, changes often | Medium | On-Demand, scheduled stop |
The order database is steady, inflexible in family, and cannot be interrupted, so the narrower EC2 Instance Savings Plan fits and gives the deeper discount. The web fleet splits into two layers. The nightly job runs only three hours a day, so a commitment would be idle 21 hours out of 24. Staging has no predictable floor, so it stays On-Demand.
Verifying with the CLI
Before committing, ask AWS what it would recommend based on your history. This command requests a one-year, no-upfront Compute Savings Plan recommendation using the last 30 days of usage.
aws ce get-savings-plans-purchase-recommendation \
--savings-plans-type COMPUTE_SP \
--term-in-years ONE_YEAR \
--payment-option NO_UPFRONT \
--lookback-period-in-days THIRTY_DAYSCompare the recommended hourly commitment with your own estimate of the steady floor. A recommendation based on 30 days can overstate the floor if that month was unusually busy, so check it against longer trends. The next chapter covers how to read coverage and utilization after you buy.
Exercise
A team runs a video transcoding service. Jobs are queued, each takes about 10 minutes, and a failed job is simply retried. Demand is high on weekdays and near zero on weekends. Which pricing model should carry most of this workload, and why would a one-year Compute Savings Plan sized to weekday peak be a poor choice?
Show answer
Spot should carry most of it. The jobs are short, retried automatically, and so tolerate a two-minute interruption notice. A Savings Plan sized to weekday peak would be billed every hour, including nights and weekends when demand is near zero, so much of the commitment would go unused. If any commitment is bought, it should cover only the lowest steady level of usage.
Exercise
An application must always be able to launch in one specific Availability Zone, even during regional capacity shortages. Usage is steady and the instance family will not change. Which commitment fits, and why is a Compute Savings Plan alone not enough?
Show answer
A zonal Standard RI fits, because a zonal RI reserves capacity in the chosen Availability Zone. A Savings Plan only lowers the price. It does not reserve capacity, so an instance could fail to launch during a shortage.