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.

Relative price (illustrative)On-demandno commitmentCommitment1 or 3 years of useSpotcan be interrupted
The same machine under three billing models. The bars only illustrate the order of magnitude.

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

ModelAWSAzureGoogle CloudOracle Cloud
On-demandOn-DemandPay-as-you-goOn-demandPay as You Go
Committed useReserved Instances and Savings PlansReservationsCommitted Use DiscountsUniversal Credits
Spare capacity (spot)Spot InstancesSpot VMsSpot VMsPreemptible 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.

ToolAWSAzureGoogle CloudOracle Cloud
Budgets and alertsAWS BudgetsCost ManagementCloud Billing (budgets)OCI Budgets
Estimate before creatingPricing CalculatorPricing CalculatorPricing CalculatorCost 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

SituationWhat to do
Server running all year, for yearsCommitted use for 1 or 3 years
Batch processing that can start overSpare capacity (spot)
Unpredictable peak, like Black FridayOn-demand
Test environment used only during office hoursTurn it off outside working hours
Backup nobody has opened in monthsArchive class (archive), as in Cloud Storage
Bill growing without an explanationCost allocation tags (cost allocation tags) to find where it comes from

Key terms

Six terms to remember

Tap a card to see the definition.

FinancialArchitecture

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.