Sub topic 1
The On-Demand Baseline and Why Discounts Exist
Prerequisites
This chapter assumes you already know the following:
- What an Amazon EC2 instance is, and how instance families and sizes are named (for example
c5.large). - What an AWS Region and an Availability Zone are.
- How to run basic commands with the AWS CLI or find your way around the Management Console.
- That cloud billing is pay-per-use: you are charged for what you run, not for owning hardware.
You do not need to know anything about Reserved Instances, Savings Plans, or Spot Instances yet. This chapter sets up the vocabulary that the later chapters rely on.
What On-Demand pricing is
On-Demand is the default way to pay for EC2. You launch an instance, you pay a fixed rate for each second it runs, and you stop paying when you stop or terminate it. There is no contract, no upfront payment, and no minimum term beyond a short billing minimum.
The main properties are:
- Per-second billing. For Linux instances, and for several other operating systems, billing is per second with a 60-second minimum per start. Some third-party AMIs from AWS Marketplace still bill per hour, so check the listing.
- No commitment. You can launch 1 instance or 500 and release them whenever you like.
- A fixed public rate. The price depends on the instance type, Region, operating system, and tenancy (shared or dedicated hardware). It does not depend on how long you have been a customer or how much you ran last month.
- No interruption by AWS. AWS does not reclaim an On-Demand instance for capacity reasons. It runs until you stop it or it fails.
On-Demand is the reference price. When AWS says a Savings Plan saves "up to 72%" or Spot saves "up to 90%", the comparison is against this rate. The published maximums describe the best cases, so expect the discount for your own workload to be smaller and to vary by instance family, Region, and term.
Looking up an On-Demand price
You can read the rate yourself with the AWS Price List API. The API is served only from a few Regions, so the command below sets --region us-east-1 even if you work elsewhere. The filters narrow the result to one Linux instance type with shared tenancy in one Region. The example assumes jq is installed.
aws pricing get-products \
--region us-east-1 \
--service-code AmazonEC2 \
--filters \
Type=TERM_MATCH,Field=instanceType,Value=c5.large \
Type=TERM_MATCH,Field=location,Value="US East (N. Virginia)" \
Type=TERM_MATCH,Field=operatingSystem,Value=Linux \
Type=TERM_MATCH,Field=tenancy,Value=Shared \
Type=TERM_MATCH,Field=preInstalledSw,Value=NA \
Type=TERM_MATCH,Field=capacitystatus,Value=Used \
--max-items 1 \
| jq -r '.PriceList[0] | fromjson | .terms.OnDemand[].priceDimensions[].pricePerUnit.USD'The command prints a single number: the hourly price in US dollars. At the time of writing, c5.large in US East (N. Virginia) is about 0.085 USD per hour. Prices change, so always run the lookup instead of trusting a number in a tutorial.
If you leave out a filter such as capacitystatus, the API returns several products (for example, capacity-reservation variants) and the first one may not be the one you want. That is the most common reason for a surprising result.
Now do the arithmetic that all later chapters build on. A month has about 730 hours (8,760 hours in a year divided by 12).
| Usage pattern | Hours per month | Cost at 0.085 USD/hour |
|---|---|---|
| Runs around the clock | 730 | about 62.05 USD |
| Runs 8 hours on weekdays only | about 170 | about 14.45 USD |
| Runs a 100-hour batch job | 100 | 8.50 USD |
One instance costs little. A fleet of 200 always-on instances at the first row costs about 12,400 USD per month, or roughly 149,000 USD per year. At that scale, a 30% reduction is worth real money, and that is the reason discount models exist.
Why AWS offers discounts at all
On-Demand gives you flexibility, and flexibility has a cost to AWS. To let any customer launch instances at any moment, AWS must keep spare capacity installed: servers, power, and networking that sit idle until someone asks for them. AWS pays for that capacity whether or not it is used.
The discount models are ways to trade something you can give for a lower price:
- You give predictability. If you promise to pay for a certain amount of usage for one or three years, AWS can plan its capacity and its revenue. In return it charges less. Reserved Instances and Savings Plans work this way.
- You give up reliability. Idle capacity earns nothing. If you agree to run on that spare capacity and accept that AWS can take it back with short notice, AWS charges much less. Spot Instances work this way.
So every discount is paid for with either commitment or risk. Keep this in mind throughout the tutorial, because it explains the behavior of each model.
The three levers
The rest of the tutorial covers the models below. This table is the map to keep in mind.
| Model | What you give up | Typical discount vs On-Demand | Risk you take on |
|---|---|---|---|
| On-Demand | Nothing | None (the baseline) | Highest price |
| Reserved Instances | Flexibility, through a 1- or 3-year commitment to an instance configuration | Up to about 72% | Paying for capacity you stop using |
| Savings Plans | Flexibility, through a 1- or 3-year commitment to dollars of usage per hour | Up to about 72% | Paying for a commitment you do not fill |
| Spot Instances | Reliability, because AWS can reclaim the instance | Up to about 90% | Interruption with two minutes of warning |
Two points are easy to miss in this table:
- Commitment models do not change how instances run. A Reserved Instance or Savings Plan is a billing arrangement. The instance behaves exactly like an On-Demand instance. It is not a different kind of server.
- Spot is different. It changes how the instance behaves, because AWS can interrupt it. That is why Spot needs application design work and the commitment models do not.
Where the discounts sit relative to the baseline
The diagram shows how the pricing models relate. All of them start from On-Demand, and the concept graph for this tutorial follows the same shape.
Common mistakes to avoid at the baseline stage
Before you commit to anything, watch for these errors.
- Treating On-Demand as the wrong choice. On-Demand is correct for new workloads, short-lived tests, and spiky demand you cannot forecast. Paying the full rate for a three-week experiment is cheaper than a three-year commitment you do not use.
- Comparing the wrong prices. A quoted rate is specific to the instance type, Region, operating system, and tenancy. Comparing a Linux price to a Windows price, or one Region to another, gives a false saving.
- Ignoring the hours. An instance that runs 170 hours a month rarely justifies a commitment sized for 730 hours. Always convert usage to hours before deciding.
- Forgetting that usage changes. Right-sizing, migrating to newer instance families, or moving to containers can shrink the usage a commitment was sized for. Reduce waste first, then commit to what remains.
- Forgetting data transfer and storage. These charges are billed separately and are not reduced by the discount models in this tutorial. They cover EC2 compute only.
Summary of the baseline
On-Demand is flexible, interruption-free, and the most expensive way to run steady workloads. Discount models exist because AWS values predictable demand and the chance to sell spare capacity. You pay for a discount with commitment or with risk. The next chapters introduce each lever, starting with how commitment discounts work.
Exercise
An instance costs 0.10 USD per hour On-Demand. Your team runs one copy 24 hours a day for a 30-day month (720 hours), and a second copy for only 60 hours that month for testing. What is the total On-Demand cost? Which of the two copies is the more obvious candidate for a commitment discount, and which discount "currency" (commitment or risk) would you pay with to lower the cost of the interruption-tolerant test copy?
Show answer
The always-on copy costs 720 x 0.10 = 72.00 USD, and the test copy costs 60 x 0.10 = 6.00 USD, so the total is 78.00 USD. The always-on copy is the obvious candidate for a commitment discount (Reserved Instances or Savings Plans) because its usage is steady and predictable. The test copy is short-lived, so a commitment would likely go unused. If the test work can tolerate being stopped, Spot is the better fit, and you would pay for that discount with risk (possible interruption) rather than with commitment.