The case
The first cloud bill arrived. Three times higher than the forecast.
Isaac calculated the store's cost by adding up the price of the VM. At the end of the month, the invoice also included the disk, the IP, the data transfer and a test VM he had forgotten to turn off.
The cloud charges for what you use. But it also charges for what you forget.
This post builds on Cloud Fundamentals, where we saw the swap of CapEx for OpEx, and uses Virtual Machines and Cloud Storage as examples of where the bill comes from.
The problem
Pay-per-use cuts both ways
Paying only for what you use is the promise of the cloud. The other side: everything that exists generates a charge, whether or not it is being used. The bill comes from a few sources:
- Compute: VMs and functions, per hour, per second or per execution.
- Storage: the space occupied, per gigabyte per month, even when it sits idle.
- Data transfer: mainly the data that leaves the provider.
- Managed services: databases, queues, load balancers, each with its own rule.
The solution
Three pricing models
The same resource can be paid for in different ways. The more predictable or flexible you are, the less you pay.
On-demand
You pay for what you use, with no commitment, and you can stop whenever you want. It is the full price.
At the store: the VM that comes up on Black Friday and goes down afterwards.
Committed use
You commit to use for 1 or 3 years and get a large discount. It pays off for constant workloads.
At the store: the database, which runs all year.
Spare capacity (spot)
The provider sells the capacity it has left over, at a discount of up to 90%, and can take it back with little notice.
At the store: the nightly report processing, which can start over.
The name in each cloud
| Model | AWS | Azure | Google Cloud | Oracle Cloud |
|---|---|---|---|---|
| On-demand | On-Demand | Pay-as-you-go | On-demand | Pay as You Go |
| Committed use | Reserved Instances and Savings Plans | Reservations | Committed Use Discounts | Universal Credits |
| Spare capacity (spot) | Spot Instances | Spot VMs | Spot VMs | Preemptible Instances |
Don't mix them up
Ingress × egress
Transferring data also costs money, and the rule is asymmetric.
Ingress
“How much does it cost to send data to the cloud?”
- Example
- Uploading the catalog photos to storage.
- Focus
- Usually free.
Egress
“How much does it cost to take data out of the cloud?”
- Example
- The customer downloads the photos, or the data goes to another region.
- Focus
- Charged per gigabyte, and more expensive to the internet and between regions.
How to control it
So you don't get a nasty surprise
Budgets and alerts
Set a monthly amount and get an alert at 50%, 80% and 100%, before the invoice arrives.
At the store: an alert in Isaac's email.
Cost allocation tags
Labels on resources (environment=test, project=store) show, on the invoice, who spends what.
At the store: the forgotten VM shows up as "test".
Right-sizing
Adjusting the size of the resource to actual use. A VM at 10% CPU can be smaller.
At the store: swapping the database VM for a smaller one.
Turn off and delete
What is not in use is turned off, and what is no longer needed is deleted.
At the store: the test environment turned off at night.
| Tool | AWS | Azure | Google Cloud | Oracle Cloud |
|---|---|---|---|---|
| Budgets and alerts | AWS Budgets | Cost Management | Cloud Billing (budgets) | OCI Budgets |
| Estimate before creating | Pricing Calculator | Pricing Calculator | Pricing Calculator | Cost Estimator |
These practices make up FinOps: a culture and a set of tools so that engineering and finance decide together how much to spend in the cloud.
In practice
What to do in each situation
| Situation | What to do |
|---|---|
| Server running all year, for years | Committed use for 1 or 3 years |
| Batch processing that can start over | Spare capacity (spot) |
| Unpredictable peak, like Black Friday | On-demand |
| Test environment used only during office hours | Turn it off outside working hours |
| Backup nobody has opened in months | Archive class (archive), as in Cloud Storage |
| Bill growing without an explanation | Cost allocation tags (cost allocation tags) to find where it comes from |
Key terms
Six terms to remember
Tap a card to see the definition.
Quick test
Three questions, exam style
01
A database runs 24 hours a day and will keep doing so for the next three years. Which pricing model is the most economical?
02
A nightly processing job can be interrupted and resumed without problems, and the company wants the lowest cost. What should it use?
03
In general, which data traffic is charged?
The question about costs on the exam is usually the same: which pricing model fits this workload? Constant calls for commitment, interruptible calls for spot, unpredictable calls for on-demand. And, so that Isaac is never surprised again, a budget with alerts and tags on the resources.