Sub topic 5
Turning workload usage into inputs
This chapter assumes you know core AWS services such as EC2, S3, and RDS, understand Regions, and can read a monthly cost breakdown. You have already picked a service and Region in the calculator. Now you fill in the usage fields. These fields decide most of the total, so the work is to turn a description of a workload into numbers.
Start from the pricing dimensions
Every service bills on a few dimensions, such as compute time, storage, requests, and data moved. Each dimension needs its own input. Write down the workload in plain terms first, then map each fact to a dimension.
| Workload fact | Pricing dimension | Calculator input |
|---|---|---|
| Web servers run 24 hours a day | Compute time | Instance count, hours per month |
| Users upload 200 GB of images a month | Storage | GB-month of S3 Standard |
| The app serves 5 million page views | Requests | Number of GET requests |
| Users download 500 GB a month | Data transfer out | GB per month |
If a fact has no matching input, you may have missed a dimension. Check the service's pricing page for the dimensions it lists.
Convert usage into the calculator's units
The calculator asks for usage per month, per day, or per hour, depending on the service. Convert your numbers into the unit it shows. Mistakes here are common and cheap to avoid.
- Compute hours. A full month is about 730 hours. An instance that runs only during business hours, such as 10 hours on 22 days, uses 220 hours, or about 30% of the month.
- Storage. S3 bills in GB-months. Average the amount stored over the month, not the amount at the end. A bucket that grows from 0 to 600 GB averages about 300 GB.
- Requests. Convert from requests per second. At 20 requests per second, a 730-hour month gives about 52.6 million requests.
- Data volume. Estimate in GB per month and check whether the field uses GB or TB.
You can run the same arithmetic yourself to sanity-check a line item. The function below multiplies an hourly rate by hours, instance count, and the fraction of the month the instances run.
HOURS_PER_MONTH = 730 # average hours in a month, a common basis for monthly estimates
def monthly_compute_cost(hourly_rate, instance_count, utilization=1.0):
"""Estimate monthly On-Demand compute cost.
utilization is the fraction of the month the instances run (0 to 1).
"""
return hourly_rate * HOURS_PER_MONTH * utilization * instance_count
# hourly_rate is an illustrative placeholder, not a current AWS price.
example_rate = 0.02
print(round(monthly_compute_cost(example_rate, instance_count=3, utilization=0.5), 2))With three instances running half the month at the placeholder rate, the result is 21.9. If the calculator shows a very different number for the same inputs, check the hours, the count, and the rate.
Use peaks and averages deliberately
A workload rarely runs at a constant level. Decide which figure each input should represent.
- Billing for compute follows what runs, so model the average number of instances if you use Auto Scaling. Or split the estimate into a baseline group and a peak group with fewer hours.
- Some dimensions bill on provisioned capacity, such as provisioned database storage or IOPS. Use the provisioned amount, not the average use.
- For traffic that spikes, estimate a typical month and a busy month. Keep both so reviewers see the range.
Common errors
- Entering an instance count but leaving the hours at the default full month for a part-time workload.
- Using the end-of-month storage size instead of the monthly average.
- Mixing up GB and TB, or requests and thousands of requests.
- Leaving out a dimension, such as request charges or backup storage, because it seemed small.
Exercise
A batch job runs on 4 instances for 6 hours a day, 30 days a month. What monthly hours should each instance have in the calculator, and what fraction of a 730-hour month is that?
Show answer
Each instance runs 6 × 30 = 180 hours a month. That is 180 / 730, or about 24.7% of the month, so utilization is roughly 0.25. The instance count stays at 4.