Every AI workload, from a weekend fine-tune to a thousand-GPU pretraining run, is assembled from three cloud building blocks: compute that runs the code, storage that holds the data, and networking that moves bytes between them. Cloud providers price and scale each one independently, and the way you combine them, especially where you place data relative to the GPUs that consume it, is often the difference between a reasonable bill and a shocking one. This lesson covers the three primitives as they actually behave for AI, and why "keep the data next to the compute" is the single most valuable habit in cloud AI cost control.
Prices in this lesson are illustrative
The dollar figures below are rounded, on-demand list-price snapshots used to
teach the shape of the math. Real rates vary by provider, region, commitment
(reserved/committed-use/spot), and change often. Always confirm against the
live pricing pages linked at the end before you budget.
Compute: renting the machines that run your models
Compute is capacity you rent by time. It comes in two common packagings:
Virtual machines (VMs), a full guest OS on a slice of a physical host (AWS EC2, GCP Compute Engine, Azure VMs). You get root, persistent config, and long-lived processes.
Containers, a packaged process sharing the host kernel, usually scheduled by Kubernetes (EKS/GKE/AKS) or a serverless runtime. Lighter to start and pack more densely, but the VMs underneath still cost money.
For AI the more consequential split is the processor:
CPU instances (e.g. AWS m//, GCP , Azure ) handle data preprocessing, dataloaders, orchestration, and serving small models. Priced in vCPU- and RAM-hours, comparatively cheap.
Ask the tutor
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
c
r
n2
D
GPU instances (e.g. AWS p5/g5, GCP a3, Azure ND) carry NVIDIA accelerators (A100, H100, and successors) for training, fine-tuning, and high-throughput inference. You rent the whole node, and you are billed for wall-clock time whether or not the GPUs are busy.
That last point drives the economics. An 8-GPU H100 node can list around $32/hr per node (illustrative). If your data pipeline starves the GPUs and they sit at 40% utilization, you are paying full price for a 40%-effective machine. Spot/preemptible pricing can cut the hourly rate substantially in exchange for possible interruption, which is why checkpointing (below) matters so much.
Storage: where datasets, checkpoints, and artifacts live
Two storage models cover almost everything in an AI stack, and choosing correctly is mostly about access pattern.
Object storage (Amazon S3, Google Cloud Storage, Azure Blob) is a flat namespace of immutable objects addressed by key and accessed over an HTTP API. It offers roughly eleven nines of durability (99.999999999%), effectively unlimited capacity, very high aggregate throughput, and the lowest cost per GB (around $0.02/GB-month for a standard tier, illustrative). Its weakness is per-request latency (tens of milliseconds) and that it is not a POSIX filesystem, you cannot mmap it or do fast random in-place writes. It is the correct home for datasets, checkpoints, model weights, and logs.
Block storage (Amazon EBS, GCP Persistent Disk, Azure Managed Disks) is a raw virtual disk attached to a single VM and formatted with a filesystem. It gives low latency and high IOPS for random access, at a higher price (around $0.08–0.125/GB-month, illustrative) and a capacity you provision up front. It is the right home for the OS/boot volume, local scratch space, a hot cache of the current dataset shard, and databases.
Object storage (S3 / GCS / Blob)
HTTP API, flat key namespace, not a POSIX filesystem
Around 11 nines durability, effectively unlimited capacity
High aggregate throughput, higher per-request latency (tens of ms)
Cheapest per GB and accessible from many workers at once
Use for: datasets, checkpoints, model weights, logs, archives
Block storage (EBS / Persistent Disk / Managed Disks)
Raw device attached to one VM, formatted with a real filesystem
Low latency, high random-access IOPS
Fixed provisioned size, usually single-attach
Several times more expensive per GB than object storage
Use for: boot volume, scratch, hot dataset cache, databases
A common, effective pattern combines them: keep the durable copy of a dataset in object storage, and stream shards onto fast local block storage (often NVMe SSD) as a cache during training.
Networking: regions, zones, VPCs, and the cost of moving bytes
Cloud capacity is organized geographically:
A region is a geographic area (for example us-east-1, europe-west4). Cross-region distances mean tens to well over a hundred milliseconds of round-trip latency.
An availability zone (AZ, or zone) is an isolated datacenter within a region. Zones in the same region are linked by fast, low-latency networking; spreading across them buys fault tolerance.
A VPC (Virtual Private Cloud) is your private virtual network, subnets per zone, routing, and security groups, that isolates your training cluster and connects it privately to storage and other services.
The part that surprises people is data-transfer (egress) pricing. The rough rules across major clouds:
Ingress (data into the cloud) is generally free.
Internet egress (data out to the public internet) is charged per GB, around $0.09/GB for the first tier (illustrative), tapering with volume.
Cross-region transfer between the provider's own regions is charged per GB, around $0.02/GB (illustrative).
Cross-AZ transfer within a region is typically around $0.01/GB per direction (illustrative).
Same-region access to object storage from compute (for example S3 to EC2 in the same region) usually incurs no transfer charge, you pay only tiny per-request fees.
Primitive
Cloud examples
AI-specific use
You are billed for
Compute, CPU
EC2 m/c/r, GCE n2, Azure D
Preprocessing, dataloaders, serving small models, orchestration
vCPU- and RAM-hours
Compute, GPU
EC2 p5/g5, GCP a3, Azure ND
Training, fine-tuning, high-throughput inference
Whole-node hours, regardless of GPU utilization
Storage, object
S3, GCS, Azure Blob
Datasets, checkpoints, model weights, logs
GB-month + requests + egress
Storage, block
EBS, Persistent Disk, Managed Disks
Boot volume, scratch, hot dataset cache, databases
Provisioned GB-month + IOPS/throughput
Networking, VPC
VPC + subnets across zones
Isolating a training cluster, private path to storage
Egress: internet, cross-region, cross-AZ
Why data locality decides your GPU bill
Colocating data with the GPUs that read it matters on three axes at once:
Bandwidth. In-region object storage delivers very high aggregate throughput to a cluster, enough to keep many GPUs fed. A cross-region path adds latency and realistically caps sustained throughput, so the pipeline becomes the bottleneck.
Cost. Reading a dataset in-region is effectively free on transfer; reading it across a region boundary charges per GB every pass. Training reads the full dataset once per epoch, so a cross-region read is not a one-time cost, it recurs on every epoch.
Latency. Cross-region round trips of 50–150 ms stall data loaders; single-digit-millisecond in-region access does not.
Because GPU nodes are billed by wall-clock time, anything that starves them, a slow, distant, or expensive data path, converts directly into paying full price for idle accelerators. Data locality is therefore not just a transfer-bill concern; it is the primary lever on effective GPU cost.
Worked example: moving a 2 TB dataset across regions
Suppose your dataset lives in an object-storage bucket in Region A, but the GPU capacity you could get is in Region B. Using billing units where 1TB=1000GB:
2TB=2000GB
One-time replication of the dataset into Region B, at an illustrative cross-region rate of $0.02/GB:
2000GB×$0.02/GB=$40
That $40 is unremarkable. The trap is streaming the data across the region boundary on every epoch instead of copying once. For a 30-epoch run:
30×$40=$1,200
The same 2 TB, read from in-region object storage into GPU nodes, costs about $0 in transfer (plus negligible per-request fees). So the fix is a single replication step:
Egress to the public internet (for example, pulling the dataset down to on-prem) at an illustrative $0.09/GB: 2000×0.09=180, i.e. $180.
Cross-AZ, same region, at an illustrative $0.01/GB per direction, even staying inside one region, a chatty pattern that reads across zones every epoch costs 2000×0.01=20, i.e. $20 per pass, or $600 over 30 epochs. In-region object storage sidesteps this because it is not tied to a single zone.
GB versus GiB is a real line item
Providers bill in decimal GB (109 bytes). If your "2 TB" dataset is
actually 2 TiB (2×240 bytes), that is 2199GB of
billable transfer, not 2000, about 10% more on every transfer charge. The gap
widens at petabyte scale.
A typical training data flow that avoids the trap
1Land raw data in a region-local bucketIngest into object storage in the same region where you will run GPUs. Ingress is free; this becomes your durable source of truth.
2Preprocess on CPU instancesClean, tokenize, and repack into large sequential shards (WebDataset, TFRecord, Parquet). Write results back to object storage in the same region.
3Provision GPU nodes in that same region and VPCKeep accelerators and data in one region; prefer one zone for tightly-coupled multi-node jobs to minimize cross-AZ traffic and latency.
4Stream shards to the GPUs, cache hot data on local block storageIn-region object reads are effectively free on transfer; NVMe/block scratch absorbs random access and repeated reads across epochs.
5Write checkpoints back to object storage periodicallyDurable, cheap, and zone-independent. On spot/preemptible nodes this lets you resume after an interruption instead of restarting.
6Persist final artifacts, then tear down GPU nodesStopping the instances is what stops the largest charge. Keep the cheap object-storage artifacts; release the expensive compute promptly.
Common mistakes
Streaming across regions every epoch. A one-time $40 copy becomes $1,200 over 30 epochs. Replicate the dataset into the compute region once, then read locally.
Leaving GPU nodes running while idle. You are billed for the whole node by wall-clock time regardless of GPU utilization, including debugging, data-copy waits, and "I'll shut it down later." Automate teardown.
Putting datasets on block storage. Block volumes are single-attach, capped at their provisioned size, and cost several times more per GB than object storage. Use object storage as the shared source of truth; use block only as a local cache.
Ignoring cross-AZ charges. Even inside one region, reading across availability zones every epoch is billed per GB in each direction. Colocate tightly-coupled jobs in a single zone, or front them with (zone-independent) object storage.
Forgetting checkpoints on spot instances. Cheaper preemptible GPUs are only cheaper if an interruption doesn't force a full restart. Checkpoint to object storage frequently.
Confusing GB with GiB. A dataset measured in TiB transfers about 10% more billable decimal GB than its "TB" label suggests, budget for it.
Further reading
Amazon S3 pricing, object-storage GB-month, request, and data-transfer rates.