AlgoViz

Google Cloud Storage

medium 27 min

Cloud Storage is Google Cloud's object store: buckets, immutable objects, strong consistency everywhere, and one API for hot and archived data.

Video lesson · Chapter 1 of 5

Give one generation of a photo a name

0:00 / 4:15

Cloud Storage in 90 seconds

1:30Reel coming soon

Theory

Read or listen first. About 2 min.

What it is

Google Cloud Storage keeps objects, which are sequences of bytes with a name and metadata, in buckets. You reach it over HTTPS, through a JSON API, an S3-compatible XML API, gRPC, or the client libraries.

An object cannot be edited in an ordinary bucket. A new upload to the same name creates a new generation and replaces the live one in a single step, so a reader sees the old bytes or the new bytes and never a mixture.

Every object has a storage class that sets what it costs to keep and to read. Unlike some other archives, all classes answer within milliseconds; the colder ones cost more to read and have a minimum storage time.

Why it exists

Files on one server are lost with that server, and a database is an expensive place for photos, videos, logs and backups. An object store spreads each object over many devices and lets any number of machines read it.

Cloud Storage adds choices that a team would find hard to build: copies in two regions behind one name, listing that is always up to date, conditional writes, and cheap classes that need no restore job.

A short history

  1. May 2010

    Google launches the service as Google Storage for Developers.

  2. March 2015

    Nearline is announced: a cheaper class that still answers online.

  3. January 2020

    The Archive class becomes available, for data read less than once a year.

  4. March 2026

    Rapid Bucket, with buckets that live in one zone and objects that can be appended to, becomes generally available. Anywhere Cache is renamed Rapid Cache in the same month.

Words to know

Bucket
A container with a globally unique name, a location and default settings.
Generation
The number of one version of an object's data. It changes on every overwrite.
Metageneration
The number of changes to the metadata of one generation.
Precondition
A condition sent with a request, such as: only if the generation is still 17.
Storage class
Standard, Nearline, Coldline, Archive, or Rapid in zonal buckets.
Dual-region
One bucket whose objects are kept in two chosen regions.
Turbo replication
An option of dual-regions with a target of 15 minutes for the second region.
Soft delete
Deleted objects stay restorable for a time, 7 days by default.
Autoclass
A bucket setting that moves objects between classes according to reads.

How it works

Step through the idea, or press Play.

Step 1 of 3

Place. Choose a location and a class for the bucket

Understand it

Start here

The cheese cave

Imagine a cave in which a village keeps its cheese. Some wheels are wanted every day and some only once a year. Where should each wheel lie?

Warm, cool and deep shelves
WARMCOOLDEEPOften wanted: near the door

Cold does not mean slow here. It means cheap to keep and costly to take out.

The idea

What it gives a system

A photo service around one bucket

A browser asks the app server for a URL, then uploads the bytes straight to the bucket. The bucket sends an event to Pub/Sub, which hands the new object to a worker.
The app server signs a permission. The bytes never pass through it.
  • Strong consistency

    After a successful write, every read and every listing shows it, in all locations and classes.

  • Durability

    Designed for 11 nines a year, with erasure coding and checksums that are verified again and again.

  • One API, many prices

    Four ordinary classes with the same calls and millisecond access.

  • Two regions, one name

    Dual-regions and multi-regions keep serving when one region is lost.

  • Conditional writes

    Generations make retries and read-change-write loops safe.

  • Scale without sizing

    A bucket has no fixed size. Request capacity grows by itself, over minutes.

The general ideas have their own pages: object storage, designing a blob store, file uploads and CDNs. This page is about how this product does them. Its neighbour is Amazon S3.

Inside

Buckets, objects and generations

A bucket name is unique across all customers, and a bucket belongs to one project and one location. An ordinary bucket is flat: a name such as photos/2026/cat.jpg is just text, and the folder is an illusion made by listing with a prefix and a delimiter.

Limits worth remembering

ThingLimit
Object size5 TiB, however it is written
Object name in a flat bucket1,024 bytes of UTF-8
Custom metadata per object8 KiB
Writes to the same object name1 per second
Writes in a bucketNo limit; about 1,000 per second at first
Reads in a bucketNo limit; about 5,000 per second at first
Sources in one compose request32
Creating or deleting bucketsAbout one request every two seconds per project

An overwrite is a swap

Nobody ever reads half of an upload. Google describes the parts below as Colossus for the bytes and Spanner for the metadata.

Hierarchical namespace is a different kind of bucket with real folders. Renaming a folder is one atomic step, and initial request rates are up to 8 times higher. It must be chosen when the bucket is created. It suits Spark, Hadoop and training jobs that rename directories.

Rapid Bucket puts a bucket into one zone, beside the machines that use it. Objects can be appended to by one writer at a time and read while they grow. Google states latency below a millisecond. The price of that: the data is not spread over zones and can be lost with its zone, so keep only what you can rebuild.

Location

What survives what

A dual-region bucket

A client writes to a dual-region bucket. Region one keeps pieces in zone A and zone B before the write is confirmed. A dashed arrow shows later copying to region two, which also has two zones.
The write is confirmed after two zones of one region have it. The copy to the second region is asynchronous.

Location types

TypeCopies before successSurvivesStandard class SLAUse it for
Zone (Rapid)In one zoneDisks, hosts, racks99.9%Scratch data for training and analytics
RegionAt least two zonesOne zone99.9%Data used by machines in that region
Dual-regionTwo zones of one region, then the other regionOne region, except the newest writes99.95%Failover between two chosen regions
Multi-regionThe same, places chosen by Google within the areaOne region, except the newest writes99.95%Content read all over a continent
An SLA is a promise of credit, not of uptime. Colder classes have lower ones: 99.9% in two regions, 99.0% in one.

Default replication aims to bring 99.9% of new objects to the second region within one hour and all within 12 hours; most take minutes. Turbo replication, for dual-regions only, has a recovery point objective of 15 minutes. Failover needs no action: the recovery time objective is zero. If a region is lost before its newest object was copied, a read of that object returns a retryable 500 error instead of an old version. That is a clear choice of consistency over availability; see CAP.

What 11 nines mean

109 objects×10−11 per year=0.01 objects per year10^{9}\ \text{objects} \times 10^{-11}\ \text{per year} = 0.01\ \text{objects per year}
A design target for hardware loss, as an average. It says nothing about a wrong delete, which is the likelier accident.

Classes

Price of keeping, price of reading

Storage classes

ClassMinimum timeRetrieval feeRead it aboutTypical availability in a region
RapidNoneNoneAll the time, from one zoneAbove 99.95%
StandardNoneNoneOften99.99%
Nearline30 daysYesOnce a month or less99.9%
Coldline90 daysYesOnce a quarter or less99.9%
Archive365 daysYesLess than once a year99.9%
Prices change and differ by location, so compare them on the pricing page with your own read rate. Multi-Regional, Regional and DRA are old names that may still appear.

Which class?

When does a colder class pay?

(phot−pcold)×GB×months>fread×GB read+operations(p_{hot} - p_{cold}) \times \text{GB} \times \text{months} > f_{read} \times \text{GB read} + \text{operations}
Savings on keeping must beat the fees for reading. Many small objects lose here: moving an object between classes is one charged operation each, whatever its size.

Early deletion. A Coldline object deleted after 20 days is billed for 90. Rewriting counts as deleting: changing a class by hand is a rewrite. Time as a noncurrent or soft-deleted object counts towards the minimum.

Autoclass starts everything in Standard, moves an object to Nearline after 30 days without a read, and, if you allow it, to Coldline after 90 and Archive after 365. A read brings it back to Standard. Objects under 128 KiB stay in Standard. There are no retrieval or early deletion fees, but there is a management fee. Background scanners that read everything defeat it.

Consistency

Strong, with three exceptions

Read-after-write, read-after-update, read-after-delete and listing are strongly consistent, for all buckets. So a job may write a marker object and list right after it. The exceptions matter in practice:

Not immediately visible

WhatHow longWhat to do
Granting or revoking accessTypically a minute, sometimes longerDo not rely on revoking in an emergency alone
Public objects in cachesUntil the cache lifetime endsNew name for new content, or Cache-Control: no-store
Bucket settings such as versioningAbout 30 secondsWait before deleting
Lifecycle rulesUp to 24 hours to take effect; actions are asynchronousDo not use them as a timer

Concurrency

Preconditions instead of locks

There is no lock and no transaction over several objects. What you have is a compare-and-set on one object: send the generation you read, and the write fails with 412 if somebody was faster. Generation 0 means: only if no live object has this name. The idea is optimistic concurrency control.

Two workers change the same index

Without the condition, A would silently erase B's change.

Preconditions also make retries safe. A repeated upload with ifGenerationMatch cannot overwrite something newer, so it is idempotent. Retry 408, 429 and 5xx with exponential backoff.

Uploads

Getting bytes in and out

WayGood forKnow this
Single requestSmall files on a good networkA break means starting again
Resumable uploadLarge files, phonesSession lives a week; chunks are multiples of 256 KiB
XML multipartParallel parts, S3 toolsFinish or abort, or the parts are billed
ComposeJoining up to 32 objects in one callThe result has a CRC32C but no MD5
Signed URLBrowsers and phones without an accountAnyone who has it can use it; at most 7 days
Shell
# A bucket in two regions, with access by IAM onlygcloud storage buckets create gs://EXAMPLE-photos \  --location=EU --placement=europe-west1,europe-west4 \  --recovery-point-objective=ASYNC_TURBO \  --uniform-bucket-level-access# Upload only if the name is still freegcloud storage cp cat.jpg gs://EXAMPLE-photos/in/cat.jpg --if-generation-match=0# Keep deleted objects for 14 days; move and delete by agegcloud storage buckets update gs://EXAMPLE-photos \  --soft-delete-duration=14d --lifecycle-file=rules.json# A link for 15 minutes, signed as a service accountgcloud storage sign-url gs://EXAMPLE-photos/in/cat.jpg --duration=15m \  --impersonate-service-account=SIGNER_ACCOUNT
Names in capitals are placeholders. Location pairs must be a supported dual-region.

Events go to Pub/Sub notifications: OBJECT_FINALIZE, OBJECT_DELETE and others. Treat them as messages that can arrive twice or out of order, and use the generation to ignore old ones. See pub-sub.

Scaling

Request rates and hot ranges

Object names are kept in an index sorted by name, and ranges of that index are spread over servers. When a range gets busy, Cloud Storage splits it, which takes minutes. Names that begin with a time or a counter send every new write to the same end of the index: a hot range that keeps moving.

Names that spread

  • 4f/2026-11-23/a.json: a hash first
  • users/<random id>/a.jpg: random after a fixed prefix
  • One random hexadecimal character is enough for about 16,000 writes and 80,000 reads a second

Names that pile up

  • 2026-11-23T10-00-00.json
  • log-0000001, log-0000002
  • A new hourly prefix: the gain is lost every hour

How long to warm up a new prefix

1000→16000 writes/s:log⁡2160001000=4 doublings×20 min=80 min1000 \rightarrow 16000\ \text{writes/s}: \quad \log_2 \frac{16000}{1000} = 4\ \text{doublings} \times 20\ \text{min} = 80\ \text{min}
Google's guideline: above 1,000 writes or 5,000 reads a second, at most double every 20 minutes. A launch needs a ramp in its plan.

Safety

Access and protection from mistakes

Prefer uniform bucket-level access: only IAM decides and per-object lists are switched off. Add public access prevention for private data. Data is encrypted at rest by default; customer-managed keys are an option, and losing such a key means losing the data.

Protection tools

ToolProtects fromCosts
Soft delete (default 7 days, range 3 to 90, 0 is off)Wrong delete or overwrite, also of a bucketDeleted bytes are billed as stored
VersioningSame, for as long as rules keep noncurrent versionsEvery version is billed
Retention policy and bucket lockAnybody deleting too early; a locked policy cannot be removedYou cannot delete either
A second bucket in another projectA lost project or stolen administrator accountA full copy

The life of an object

Restoring writes a new live copy in the Standard class.

Operations

What to watch

  1. 1

    Errors by code

    429 and 503 point to a hot range or a fast ramp. 412 means preconditions at work; a sudden rise means contention.

  2. 2

    Bytes by class and state

    Live, noncurrent and soft-deleted. A bill that grows without new users is often in the last two.

  3. 3

    Replication delay

    For dual-regions, how old the newest object is that exists in only one region.

  4. 4

    Egress

    Bytes that leave the region. Put computing near the data, and a CDN before public files.

  5. 5

    A regional or global incident

    In June 2025 many Google Cloud APIs failed worldwide at once. Two regions do not protect from that; see the Google Cloud outage.

Decide

When to choose it, and when not

Choose it when

  • You already run on Google Cloud, or use BigQuery on the data
  • Objects are written once and read many times
  • One name must survive the loss of a region
  • Archived data must be readable at once
  • You want nothing to operate

Look elsewhere when

  • Data changes in place: use a database or a disk
  • You need queries or transactions over records
  • One key changes many times a second
  • The bytes must stay in your own building: see MinIO

Neighbours

ProductAlikeDifferent
Amazon S3Objects, strong consistency, classes, conditional writesTwo regions mean two buckets with replication; its deep archive classes need a restore
MinIO AIStorObject API, erasure codingYou run it, on your own drives
FilestoreFiles over the networkA mounted file system with directories and locks
Persistent DiskDurable bytesA block device for machines, edited in place
Cloud Storage FUSEShows a bucket as a folderStill objects: an edit rewrites, and it is not a full POSIX file system

Summary

The whole topic in one minute.

Cloud Storage is a strongly consistent store of immutable objects. Region, dual-region or multi-region decides what survives; the class decides the price of keeping against reading; the object name decides how load spreads.

Send a generation precondition with every write that could be repeated, sign URLs instead of passing bytes through your servers, ramp up new prefixes slowly, and remember that soft-deleted and short-lived objects are still billed.

  • Objects are immutable; an overwrite is a new generation, visible at once everywhere.
  • Location decides what survives: the second region is always a little behind.
  • Cold classes are not slow. They have fees and minimum times.
  • Preconditions make retries and read-change-write safe.
  • Spread names, double at most every 20 minutes, and one name takes one write a second.
  • Soft delete is on by default and is billed.

Sources