Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

What is a bucket, and why can't you append to a file in it?

GeoStack · background · key → bytes

Abstract

Pictures first. S3, Azure Blob Storage and Google Cloud Storage are not disks. Each is a dictionary from a name to a blob of bytes, reached over HTTP with five operations. Cloud-native formats, catalogs and versioned stores are all designed around what those five can and cannot do.

The running example

Keys, not folders

What the store holds: a flat, sorted list of keys
…/S2A_31TCJ_20260612_0_L2A/B11.tifbytes
…/S2A_31TCJ_20260612_0_L2A/B12.tifbytes
…/S2A_31TCJ_20260612_0_L2A/SCL.tifbytes
…/S2A_31TCJ_20260617_0_L2A/B11.tifbytes
…/S2A_31TCJ_20260617_0_L2A/B12.tifbytes
What a browser showsS2A_…_20260612_0_L2A/B11.tifB12.tifSCL.tifS2A_…_20260617_0_L2A/B11.tifB12.tifFolders are drawn from the “/” in the keys. None exist.

A bucket is a dictionary from key to bytes. The highlighted key is the running example’s object. “Listing a folder” is really “list every key that starts with this prefix”.

An object is a blob of bytes plus a little metadata (size, time, a fingerprint called the ETag). A key is its full name. A bucket (Azure: container) holds the keys. The store keeps keys sorted, which is why a prefix search is possible and nothing else is: you cannot ask for “every B12.tif” without walking every scene prefix.

Five verbs

PUTwrite a whole objectone request, all or nothing
GETread an object, or a byte range of itRange: bytes=a-b
HEADsize, time and ETag, no bytesthe ETag changes when the object does
LISTkeys under a prefix1 000 per page, in key order
DELETEremove an object
Not on the listappend to an objectedit bytes in placerename (it is copy + delete)lock an object

Five verbs, each one HTTP request. Everything a format or a catalog does on the cloud is built from these, and shaped by the four that are missing.

The missing operations matter more than the present ones. No append means a growing array cannot be one growing file, so Zarr stores one object per chunk. No rename means the usual “write to a temp file, then rename” trick for safe writes does not exist. No lock means two writers cannot take turns unless the format gives them a way.

Range requests: reading part of an object

your codeobject store

GET bytes=0–16383206 · header: where every tile is · 16 kB

GET bytes of tile 38206 · one compressed tile · ≤\le 524 kB

GET bytes of tile 39206 · one compressed tile · ≤\le 524 kB

GET bytes of tile 49206 · one compressed tile · ≤\le 524 kB

GET bytes of tile 50206 · one compressed tile · ≤\le 524 kB

The window read from the storage formats page, as HTTP. Status 206 means “partial content”. Five requests fetch about 2.1 MB uncompressed out of a 60.28 MB band; the four tile requests can run at the same time.

A range request is a GET with a header naming the bytes wanted. It costs about the same as any other request, whatever the object’s size. A format is cloud-native when its index sits where one small range request can fetch it and points to byte ranges for everything else. The storage formats page shows how COG, GeoParquet and Zarr each do that.

import obstore

# not pinned (obstore)
store = obstore.store.S3Store("sentinel-cogs", region="us-west-2", skip_signature=True)
key = "sentinel-s2-l2a-cogs/31/T/CJ/2026/6/S2A_31TCJ_20260612_0_L2A/B12.tif"

# not pinned (obstore)
head = obstore.head(store, key)                       # size, last_modified, e_tag
# not pinned (obstore)
header = obstore.get_range(store, key, start=0, end=16_384)       # → 16 384 B
# not pinned (obstore)
tiles = obstore.get_ranges(store, key, starts=starts, ends=ends)  # → 4 buffers

# not pinned (obstore)
# fails if the key already exists: a conditional PUT
obstore.put(store, "models/_tags/v3", b"<hash>", mode="create")

Each request has a fixed cost of tens of milliseconds before the first byte arrives, so a read is priced in requests more than in bytes. Two consequences: merge nearby ranges into one request, and send independent requests at the same time (the parallelism page measures that: 121 tile fetches drop from 6.4 s to 0.23 s).

Listing is the slow verb

Find 60 500 chunk objects by listing
61 pages of 1 000 keys, one after another: each page says where the next starts Find them from an index
1 GET of a manifest that lists every chunk

Listing is paged and sequential, so it scales with the number of objects, not with what you want. This is why Zarr has consolidated metadata, Icechunk has manifests, and geocatalog keeps a table of files.

Writing safely: one PUT, or a pointer swap

One PUT is all-or-nothing
PUT weights.binreaders see the old object or the new one, never half
Four PUTs are four separate events
operator.jsonweights.binmetadata.json_tags/v3
crash here: two of four objects exist A conditional PUT lets exactly one writer win
writer APUT refs/main If-Match: etag-7 → 200, now etag-8
writer BPUT refs/main If-Match: etag-7 → 412, try again

The middle row is pipekit’s model registry today (operator, weights, metadata, tag). The bottom row is how a versioned store commits safely: every new object is written under a fresh key, then one small pointer is swapped with a condition.

S3, Azure and GCS are strongly consistent: once a PUT returns, every later GET and LIST sees it. That covers one object. For several objects that must change together, the pattern is always the same: write the new objects under keys nobody reads yet, then make them visible with one conditional write. Icechunk commits this way; the versions and identity page builds on it.

Three providers, one model

AWS S3Azure Blob / ADLS Gen2Google Cloud Storage
Container of keysbucketcontainer (in a storage account)bucket
URIs3://bucket/keyaz://container/key, abfs://gs://bucket/key
Range readsyesyesyes
Conditional writesIf-None-Match, If-MatchETag conditions, leasesgeneration preconditions
Real directoriesnoyes, with the hierarchical namespace (ADLS Gen2): atomic directory renameno (optional on newer bucket types)
Auth you will meetkeys, roles, unsigned public accessaccount keys, SAS tokens, managed identityservice accounts

The differences are in names and credentials. Libraries such as obstore and fsspec hide them behind one interface, which is why the stack addresses everything by URI.

In your stack

Checked at geotoolz 640670c and pipekit 9e86a56.

WhereWhat it does with the bucket
geocloud store.pyone process-wide pool of obstore clients, keyed by URI root (S3, Azure, GCS, Hugging Face, local); credentials live in the store, keys in object_key(uri)
geocloud CogSourcerange requests for COG headers and tiles through async-geotiff on the pooled client
geocloud filescopy between stores, 8 objects at a time
geocataloglists once to build a catalog, then answers queries from the table, never from LIST
pipekit S3ModelRegistryfour PUTs per registered model, the tag last; the reason for the transactional registry in the recipe registries design
import geocloud.store

# today (geocloud)
store = geocloud.store.get_obstore("s3://sentinel-cogs/sentinel-s2-l2a-cogs/31/T/CJ/")
# today (geocloud)
key = geocloud.store.object_key(uri)       # the part of the URI after the store's root

Where this goes next

Idea hereShows up as
Range requestshow COG, Parquet and Zarr are read (storage formats)
An index instead of LISTcatalogs and STAC (databases and catalogs); Icechunk manifests
New keys, then a conditional pointer swapsnapshots and commits (versions and identity); Level 2 collections, B
Four PUTs are not atomicthe transactional model registry (recipe registries, H)