Summary#
Object storage (also called blob storage) stores files as objects, each made of data, metadata and a unique key inside a bucket, accessed over an HTTP API (PUT, GET, DELETE, LIST). It is the standard home for images, video, backups, logs and data lakes because it is practically unlimited, very durable (Amazon S3 is designed for eleven nines), and cheap. Durability comes from replication or erasure coding across devices and data centres. Clients upload and download directly using presigned URLs, large files go up in parallel parts with multipart upload, and storage classes with lifecycle rules move old data to cheaper tiers. It is not a database: no in-place updates, no queries, tens of milliseconds per request.
Why It Exists#
Files fit poorly in databases or on single servers. A photo app with 1 billion photos at 2 MB each stores 2 PB: in a database, backups and replication suffer; on a server's disk, one failure loses data. Object storage separates large immutable blobs from structured data, scales them independently and makes durability someone else's engineering problem. This page builds on Storage Fundamentals.
How It Works#
Object model: bucket, key, metadata#
- A bucket is a top-level container with a globally unique name (in S3), a region and its own access policies, versioning and lifecycle settings.
- A key is the object's full name within the bucket, such as
users/42/avatars/2026-12-01.jpg. The namespace is flat: slashes only look like folders;LISTwith a prefix and delimiter simulates directories. - An object holds the bytes (from 0 bytes up to 5 TB in S3), system metadata (size, content type, ETag checksum, last modified, storage class) and user metadata (custom key-value headers).
- Objects are immutable: to change one, upload a new version of the whole object. With versioning enabled, old versions are kept and can be restored after an accidental overwrite or delete.
Object model in depth#
Keys are the only index. An object store can find an object only by its exact key, or list keys in lexicographic order under a prefix. That shapes key design.
- Put the thing you will list by first. Use
tenant/42/invoices/2026/12/inv-981.pdfif you list one tenant's invoices. - Avoid user-controlled names in keys. Generate an ID such as
uploads/7f3c.../originaland keep the display filename in the database. That prevents collisions, path tricks and enumeration of other users' files. - Keep keys stable. A "rename" is a copy plus a delete, which for a 50 GB object means re-writing 50 GB server-side.
Listing. LIST returns up to 1,000 keys per call in sorted order, with a continuation token for the next page. Passing a delimiter of / groups deeper keys into "common prefixes", which is how consoles show folders. Listing a bucket with 1 billion keys therefore takes 1 million sequential calls. That is fine for an offline job but useless on a request path. For bulk analysis use an inventory report (S3 Inventory writes a daily or weekly list of all objects to a bucket). For lookups, keep your own index in a database.
Versioning semantics. With versioning enabled, every PUT to a key creates a new version with its own version ID, and a GET without an ID returns the latest. A DELETE without a version ID does not remove data. It adds a delete marker, a tombstone that hides the object, and removing the marker brings the object back. Deleting a specific version ID removes that version permanently. Versioning protects against overwrites and accidents, but every version is billed. Pair it with a lifecycle rule that expires noncurrent versions after, say, 30 days. A bucket can be versioning-suspended, but never fully un-versioned once enabled.
ETags and checksums. The ETag identifies an object's content version. For a single-part upload without KMS encryption, it is the MD5 of the bytes. For multipart uploads it is a hash of the parts' hashes followed by -N, where N is the part count, so it is not the file's MD5. Never use it as a content hash across upload methods. S3 also supports additional checksums (CRC32, CRC32C, SHA-1, SHA-256) computed by the client and verified on upload, which give end-to-end integrity from the client's disk to the stored object.
Metadata limits. User-defined metadata is sent as x-amz-meta-* headers, limited to about 2 KB in S3, and it can only be changed by copying the object onto itself. Object tags, up to 10 key-value pairs, can be updated without rewriting data and can drive lifecycle rules and access policies. Anything you want to search, sort or join belongs in a database row that points at the key.
Conditional requests. Reads accept If-Match, If-None-Match and If-Modified-Since, so caches can revalidate cheaply. S3 added conditional writes in 2024. A PUT with If-None-Match: * fails if the key already exists (create-only), and a PUT with If-Match: <etag> succeeds only if the object is unchanged. Google Cloud Storage offers the same with generation preconditions. These turn the object store into a simple compare-and-swap register, which is enough to build manifests, leases and commit protocols without a separate database.
S3-style architecture#
The public details of S3's internals are limited, but S3-style systems (and open-source ones such as MinIO and Ceph) share this shape:
- API front end: stateless servers that authenticate requests (signed with access keys), enforce policies and route them.
- Metadata service: maps
(bucket, key, version)to the locations of the object's data pieces. It is a partitioned, replicated key-value store, sharded by key.LISToperations read from it. - Storage nodes: many servers with large disks storing chunks of object data.
- Placement: decides where chunks go, spreading them across disks, racks and availability zones.
- Background processes: verify checksums (scrubbing), rebuild data from failed disks (repair), apply lifecycle rules and garbage-collect deleted data.
A PUT splits the data into chunks, writes them (with redundancy) to several storage nodes, and only then commits the metadata entry, so a reader never sees a half-written object. A GET looks up metadata, then streams chunks from storage nodes. For a full design, see Design an Object Storage System.
S3 scales request rates per key prefix: AWS documents at least 3,500 writes and 5,500 reads per second per prefix, and spreading keys across prefixes multiplies that.
S3-style architecture in depth#
The write path. A PUT goes through the following steps. The order is what makes partial writes invisible.
If the client disconnects or a checksum fails before the metadata commit, the chunks already written are orphans. A background garbage collector later finds chunks that no metadata entry references and reclaims them. Deletes work the same way in reverse: remove or tombstone the metadata first, then reclaim chunks asynchronously. That is why deleted data takes some time to stop occupying disks, and why storage systems keep "deleted but not yet reclaimed" capacity in their models.
The metadata layer and prefix scaling. The index from (bucket, key) to locations must support point lookups and ordered listing, so it is usually range-partitioned by key, like Bigtable or HBase. Each partition serves a contiguous key range. When a range gets hot, the system splits it, which is why S3's throughput scales "per prefix". A sudden burst at a brand-new prefix can briefly return 503 Slow Down while partitions split. Keys that all start with a timestamp, such as 2026-12-02T10:..., concentrate writes in one range. Prefixing with a hash or a tenant ID spreads them. AWS's guidance moved away from mandatory random prefixes after S3's 2018 performance increase, but the partitioning principle still explains hot-spot behaviour.
Storage nodes. Storage nodes rarely store each object as a separate file on a file system. Millions of small files make file-system metadata the bottleneck. Instead, they append chunks to large extent or volume files and keep an index of offsets, the same idea Facebook's Haystack used for photos. AWS described ShardStore, the Rust key-value storage node in S3, in "Using Lightweight Formal Methods to Validate a Key-Value Storage Node in Amazon S3" (Bornholt and colleagues, SOSP 2021). It is a log-structured design that stores chunks in extents on disk. The paper explains how they used property-based testing and model checking against a reference model, to catch crash-consistency bugs that ordinary tests miss.
Placement without a central map: CRUSH. Ceph, a widely used open-source system with an S3-compatible gateway (RGW), avoids a central chunk-location table. Its CRUSH algorithm, from "CRUSH: Controlled, Scalable, Decentralized Placement of Replicated Data" (Sage Weil and colleagues, SC 2006), computes placement from the object's hash and a description of the cluster hierarchy (rows, racks, hosts, disks) with weights. Any client with the cluster map can calculate where an object lives. When disks are added, only a proportional share of data moves, much like consistent hashing (see Consistent Hashing).
MinIO's approach. MinIO groups drives into erasure sets. It hashes each object name to one set, and writes the data and parity fragments plus a small metadata file (xl.meta) to each drive in the set. There is no separate metadata database. That keeps deployment simple and point lookups fast, at the cost of slower listings over very large namespaces, since listing must merge directory walks across drives.
Front ends at scale. API front ends are stateless and sit behind DNS that returns many IP addresses, so clients spread across thousands of servers. High-throughput clients open many parallel connections. The AWS Common Runtime (CRT) based clients do this automatically, splitting large GETs and PUTs into parallel byte ranges and parts to reach tens of Gbps from a single instance.
Durability via replication and erasure coding#
Disks fail all the time at this scale, so durability is designed in.
- Replication: store three full copies in different failure domains (often different zones). Simple and fast to read and repair, but costs 3x the raw storage.
- Erasure coding: split an object into k data fragments and compute m parity fragments; any k of the k + m fragments can rebuild the object. With 10 + 4, for example, any 4 fragments can be lost, at only 1.4x storage overhead.
| 3x replication | Erasure coding (10 + 4) | |
|---|---|---|
| Storage overhead | 3x | 1.4x |
| Failures tolerated | 2 copies | 4 fragments |
| Read cost | Read one copy | Read k fragments (more if some are missing) |
| Repair cost | Copy one replica | Read k fragments to rebuild one, more network and CPU |
| Fits | Hot, small objects; low latency | Large and cold data at scale |
Large systems often combine them: recent or small objects replicated, older and larger objects erasure-coded. Checksums on every chunk detect silent corruption, and scrubbing finds it before it spreads. Durability is not a backup: if your code deletes an object, it is durably deleted. Use versioning, object lock and cross-region replication for protection against mistakes and regional disasters.
Durability in depth#
How erasure coding works. Reed-Solomon codes, from "Polynomial Codes over Certain Finite Fields" by Irving Reed and Gustave Solomon (1960), treat the k data fragments as values of a polynomial over a finite field, usually GF(2^8), where each byte is a field element. The m parity fragments are further evaluations of the same polynomial. Any k points determine a polynomial of degree k − 1, so any k of the k + m fragments rebuild the data. Codes with this "any k suffice" property are called maximum distance separable (MDS). The best possible fault tolerance for a given overhead is m failures for an overhead of (k + m) / k. Encoding and decoding are fast in practice using lookup tables and SIMD instructions, for example Intel's ISA-L library, reaching several GB per second per core.
A rough durability calculation. Durability models ask: what is the chance that more than m fragments of the same object are lost before repair finishes? Assume the following:
- Disks have a 2% annual failure rate (AFR). Fleet studies such as Backblaze's published statistics often show 1-2%.
- A lost fragment is rebuilt within 6 hours.
- We use 3× replication.
Data is lost only if both other copies fail within the repair window after the first failure. The chance that one specific disk fails within a 6-hour window is about 0.02 × 6 / 8,760 ≈ 1.4 × 10⁻⁵. Both remaining disks failing in that window is about (1.4 × 10⁻⁵)² ≈ 2 × 10⁻¹⁰ per first failure. Multiplied by the 0.02 × 3 = 0.06 chance per year that some copy fails first, this gives roughly 10⁻¹¹ per object per year, which is in eleven-nines territory. Erasure coding with 10 + 4 tolerates 4 losses, so its loss probability falls even faster as repair gets quicker.
The model shows the levers. You can repair faster, add parity, or make failures more independent. It also shows the trap: the maths assumes independent failures. Correlated events break it. A bad firmware batch, a power loss in one building, or a software bug that deletes data everywhere at once all do. That is why fragments are spread across availability zones and why software rollouts are staged.
Repair cost and local reconstruction codes. With plain Reed-Solomon 12 + 4, rebuilding one lost fragment means reading 12 others, which costs 12× the fragment size in network traffic. Since single-fragment loss is by far the most common case, that is expensive. Microsoft's "Erasure Coding in Windows Azure Storage" (Huang and colleagues, USENIX ATC 2012) introduced Local Reconstruction Codes (LRC). The 12 data fragments are split into two groups of 6, each with its own local parity, plus 2 global parities, giving 12 + 2 + 2 = 16 fragments, an overhead of 1.33×. A single failure is repaired from just 6 fragments, halving repair reads, while the code still tolerates any 3 failures and many patterns of 4.
Cross-region economics. Facebook's f4 paper ("f4: Facebook's Warm BLOB Storage System", Muralidhar and colleagues, OSDI 2014) moved older, less frequently read photos from 3.6× replicated Haystack storage to Reed-Solomon (10, 4) within each data centre. It then protected against data-centre loss by XOR-combining blocks from two regions and storing the XOR in a third. The effective replication factor fell to about 2.1 while it still survived the loss of a whole region. This is the general idea behind tiered storage: hot data favours replication for fast reads, while warm and cold data favour wide erasure codes.
Silent corruption and scrubbing. Disks, memory and network cards occasionally flip bits without reporting an error. Object stores keep a checksum per chunk, verify it on every read, and run scrubbers that re-read all data periodically, often every few weeks. A mismatch triggers a rebuild from other fragments. Without scrubbing, a corrupt fragment could sit unnoticed until the moment it is needed for a repair, and then the object is lost.
Durability is not availability. S3 Standard is designed for 99.99% availability, and the S3 SLA commits to 99.9% for Standard, with service credits below that. That is a different number from the eleven nines of durability. A region-wide outage can make objects unreachable for hours without losing a byte, as the S3 us-east-1 incident of February 2017 showed. If downtime matters, replicate across regions and make clients able to fail over.
Consistency#
Since December 2020, Amazon S3 provides strong read-after-write consistency for all PUT, DELETE and LIST operations: once a write succeeds, any later read or list returns the new data. Before that, overwrites and deletes were eventually consistent. Google Cloud Storage and Azure Blob Storage are also strongly consistent for object operations. Other S3-compatible systems vary, so check before relying on it.
Strong consistency covers single objects. There are no multi-object transactions: uploading 100 files is 100 independent operations, so applications usually write a manifest or a database row last to mark a set as complete. Concurrent writes to the same key are resolved as "last writer wins"; S3 supports conditional writes (for example, fail if the object already exists) for safer coordination.
Consistency in depth#
What eventual consistency used to look like. Before December 2020, a new object written to S3 was readable immediately, with one caveat. If a client had issued a GET or HEAD for that key before it existed, a cached "not found" could persist briefly. Overwrites and deletes were eventually consistent, so a read soon after an overwrite could return the old bytes, and LIST could miss new keys for a while. Big-data tools that relied on listing to find job outputs could silently skip files. That led to workarounds such as Netflix's S3mper and EMRFS consistent view, which kept a separate consistent index in DynamoDB. AWS later described adding a cache-coherence protocol and a replicated witness component to S3's metadata layer, to provide strong consistency without a latency or price increase.
What "strong" covers today. On S3, Google Cloud Storage and Azure Blob Storage:
- After a successful
PUTorDELETE, every subsequentGET,HEADandLISTreflects it. - A read never returns a partially written object.
They do not provide:
- Multi-object atomicity. Writing
part-1topart-100is 100 separate commits. Readers can see some but not all. - Ordering of concurrent writers. Two simultaneous
PUTs to one key end with one winner, decided by the store, and the loser's data is gone unless versioning is on. - Strong consistency across regions. Cross-region replication is asynchronous. S3 Replication Time Control commits to replicating 99.99% of objects within 15 minutes, so the replica can lag.
- Bucket configuration changes propagate eventually. A new bucket policy or lifecycle rule may take a short time to apply everywhere.
Commit patterns on top of objects. Because there are no multi-object transactions, systems commit through one atomic write:
- Write data, then a manifest. Upload all files under a unique prefix, then write
_manifest.json(or a database row) listing them. Readers look only at manifests, so a half-finished job is invisible. Apache Iceberg and Delta Lake build on this idea. Each table version is a metadata file naming exactly which data files belong to it, and a commit swaps a pointer to the new version. - Atomic pointer swap. Delta Lake on S3 originally needed an external coordinator, such as a DynamoDB-based log store, for multi-writer commits, because S3 lacked put-if-absent. With S3's conditional writes, a create-only
PUTof the next log entry (00000000000000000042.json) can act as the commit. Only one writer can create version 42. - Immutable keys. Never overwrite. Write a new key per version (
avatar/42/v7.jpg) and update the pointer in the database. Caches and CDNs then never serve stale bytes for a key, because the bytes for a key never change.
Event notifications are at-least-once. S3 event notifications to SQS, SNS, Lambda or EventBridge are usually delivered within seconds. They can be delayed, duplicated, or arrive out of order relative to other events for the same key. Design consumers to be idempotent: use the key plus the version ID or sequencer as a deduplication key. Also run a periodic reconciliation that compares database rows still in uploading state with what actually exists in the bucket.
Presigned URLs#
Routing large uploads and downloads through your application servers wastes their bandwidth and memory. Instead, the server creates a presigned URL: a normal object URL plus a signature, an expiry time and the allowed operation, signed with the server's credentials. The client uses it to talk to object storage directly.
Good practice: short expiry (minutes), restricted content type and size, server-generated keys, and confirming uploads through storage events before treating the file as ready. For downloads of private content, presigned GET URLs (or signed CDN URLs) grant temporary access without making the bucket public. See Pattern: Handling Large Blobs.
Presigned URLs in depth#
Why not proxy through the app? Routing a 2 GB upload through an API server ties up a connection and a worker for the whole transfer, often minutes on a mobile network. The server pays for the bytes twice, client to server and server to storage, and needs memory or disk to buffer them. Load balancers often cap request bodies and time out long requests, and the application fleet must scale with bandwidth rather than with requests. A direct upload removes the application from the data path completely. The application only authorises the transfer and records the result.
The three-step flow, as in a Dropbox-style design.
- Request. The client calls the backend with the file's metadata (name, size, type, and optionally a content hash). The backend checks permissions and quota, generates the object key, inserts a metadata row with
status = 'uploading', and returns a presigned URL. - Upload. The client sends the bytes with a
PUTstraight to the presigned URL. The file is the request body. - Confirm. The storage service emits an object-created notification, and the backend marks the row
uploaded. Alternatively, the client calls a "complete" endpoint and the backend verifies the object with aHEAD. Doing both is common: the client callback gives speed, and the event gives a guarantee.
Rows stuck in uploading for longer than the URL's expiry plus a margin are abandoned uploads. A sweeper deletes the row, and the object if present.
What is inside the URL. An AWS Signature Version 4 presigned URL carries several query parameters:
X-Amz-Algorithm,X-Amz-Credential(access key ID, date, region and service),X-Amz-Date,X-Amz-Expires(in seconds, up to 7 days), andX-Amz-SignedHeaders.X-Amz-Signature: an HMAC-SHA256 over a canonical form of the request, meaning method, path, sorted query string and signed headers.
The signing key is itself derived by chaining HMACs of the secret key with the date, region and service. Storage recomputes the signature from its copy of the secret, so no call back to your server is needed. Changing anything that was signed, such as the key, method or a signed header, invalidates the URL. A URL signed with temporary STS credentials also stops working when those credentials expire, even if X-Amz-Expires says otherwise.
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const s3 = new S3Client({ region: "us-east-1" });
export async function presignUpload(userId: string, contentType: string, size: number) {
if (size > 500 * 1024 * 1024) throw new Error("too large");
const key = `uploads/${userId}/${crypto.randomUUID()}`;
const cmd = new PutObjectCommand({
Bucket: "media-originals", Key: key,
ContentType: contentType, // client must send the same header
ContentLength: size, // signed, so the body size is pinned
});
const url = await getSignedUrl(s3, cmd, { expiresIn: 900 }); // 15 minutes
return { key, url };
}Enforcing size and type. A presigned PUT can pin Content-Type and Content-Length only if they are included as signed headers. A presigned POST (an HTML form upload) carries a signed policy document that can express ranges, such as content-length-range between 1 byte and 500 MB, or a key prefix condition. Neither checks what the bytes really are. A file labelled image/png may be anything. So treat uploads as untrusted. Write them to a quarantine prefix or bucket, run validation, malware scanning and image decoding in a worker, and only then move or mark them as usable.
Preventing abuse.
- Rate-limit the presign endpoint per user.
- Enforce per-user storage quotas at presign time, and re-check the real size after upload.
- Keep expiries short (5-15 minutes for uploads).
- Never let clients choose arbitrary keys.
- Configure bucket CORS to allow only your web origins and the methods you use.
Block public access at the account level, so that a misconfigured object ACL cannot expose data.
Downloads. For private files, return a presigned GET with a short expiry. Add response-content-disposition=attachment; filename=... so browsers download rather than render untrusted HTML. For high-volume downloads, put a CDN in front and use CDN signed URLs or signed cookies (CloudFront supports both), so that edge caches serve repeated reads. Restrict the bucket so that only the CDN can read it, through origin access control. A signed cookie covering /videos/123/* suits streaming, where a player fetches hundreds of segment files.
Multipart upload#
Uploading a 10 GB video in one request is fragile: one network blip restarts everything. Multipart upload splits the object into parts that upload independently and in parallel:
- Initiate the upload and receive an upload ID.
- Upload parts (in S3, 5 MB to 5 GB each, up to 10,000 parts) in parallel, each with its own presigned URL. Failed parts are retried alone.
- Complete the upload with the list of part numbers and ETags; the store assembles the object atomically.
S3 recommends multipart for objects over about 100 MB, and it is required above 5 GB (the single-PUT limit). Set a lifecycle rule to abort incomplete multipart uploads, because their parts are stored and billed until then. The same idea works for downloads: byte-range GETs fetch parts of an object in parallel or resume an interrupted download.
Multipart upload in depth#
Choosing a part size. S3 allows parts from 5 MB to 5 GB (the last part may be smaller) and at most 10,000 parts, so the maximum object is 5 TB. The part size sets the trade-offs:
- Upper bound on object size: part size × 10,000. With 8 MB parts the limit is about 80 GB. A 5 TB object needs parts of at least about 525 MB.
- Retry cost: a failed part is re-sent in full. On a flaky mobile link, 5-16 MB parts waste little. On a data-centre link, 64-128 MB parts reduce request overhead.
- Parallelism: a single TCP stream to object storage often reaches 50-100 MB per second. Eight to sixteen parallel parts can saturate a 10 Gbps link.
A 10 GB upload with 100 MB parts is 100 parts. At 8 in flight and 80 MB per second each, it finishes in about 16 seconds on a fast network. A single stream would need about 2 minutes.
Resuming after failure. The upload ID is the resume handle. The client records which parts have succeeded, and their ETags, in local storage. After a crash or a network change it calls ListParts to see what the server already has, uploads only the missing parts, and then completes. The client never re-sends the first 99% of a file that failed at 99%. The backend can mint presigned URLs per part, so the client never holds long-lived credentials.
Completing and aborting. CompleteMultipartUpload takes the ordered list of part numbers and ETags and assembles the object atomically. Until then, the object does not exist for readers, although the parts are stored and billed. AbortMultipartUpload discards them. A lifecycle rule such as abort_incomplete_multipart_upload after 1-7 days catches the uploads clients forget. Without it, buckets quietly accumulate terabytes of invisible, billable parts.
Other providers' equivalents.
- Google Cloud Storage offers resumable uploads: a session URI to which chunks (multiples of 256 KiB) are sent in order, and the client can ask how many bytes were received. It also offers XML API multipart uploads and object compose, which concatenates up to 32 objects into one.
- Azure Blob Storage builds block blobs from up to 50,000 blocks, uploaded with Put Block and committed with Put Block List. Uncommitted blocks expire after about a week.
- The open tus protocol standardises resumable uploads over HTTP for servers you run yourself.
Content-defined chunking and deduplication. Sync products go further than multipart upload. Dropbox splits files into fixed 4 MB blocks identified by their hash. The client first asks which block hashes the server lacks, and uploads only those. Editing one paragraph of a 1 GB file then re-uploads one block, and identical files across users are stored once. Content-defined chunking, with block boundaries chosen by a rolling hash such as Rabin fingerprints rather than fixed offsets, keeps most blocks unchanged even when bytes are inserted near the start of a file. The trade-off is a metadata layer that maps files to block lists.
Parallel and partial downloads. A GET with Range: bytes=0-8388607 fetches the first 8 MB. Clients fetch many ranges in parallel for throughput, and resume interrupted downloads from the last complete range. Analytical engines use ranges to read only the footer and the needed column chunks of a Parquet file, rather than the whole object. Video players use ranges, or pre-split segments, to start playback quickly and seek.
Storage classes and lifecycle rules#
Providers offer storage classes that trade price per GB against retrieval cost and speed:
| Class (S3 names) | Fits | Trade-off |
|---|---|---|
| Standard | Frequently accessed data | Highest storage price, no retrieval fee |
| Standard-IA / One Zone-IA | Accessed less than about monthly; backups | Lower storage price, per-GB retrieval fee, minimum storage duration |
| Intelligent-Tiering | Unknown or changing access patterns | Small monitoring fee; moves objects between tiers automatically |
| Glacier Instant / Flexible / Deep Archive | Archives, compliance data | Cheapest storage; retrieval from milliseconds (Instant) up to hours (Deep Archive) |
Lifecycle rules apply transitions and expiry automatically, by prefix, tag or age:
# Illustrative lifecycle policy
rules:
- id: media-originals
filter: { prefix: "originals/" }
transitions:
- { days: 30, storage_class: STANDARD_IA }
- { days: 365, storage_class: GLACIER_DEEP_ARCHIVE }
- id: temp-uploads
filter: { prefix: "tmp/" }
expiration: { days: 1 }
abort_incomplete_multipart_upload: { days: 1 }Storage classes in depth#
The cost model has four parts: storage per GB-month, requests per thousand, retrieval per GB for colder classes, and data transfer out. Approximate S3 list prices in us-east-1 at the time of writing (always check current pricing) are:
| Class | Storage per GB-month | Minimum duration | First byte | Notes |
|---|---|---|---|---|
| Standard | about $0.023 | none | tens of ms | No retrieval fee |
| Standard-IA | about $0.0125 | 30 days | tens of ms | Retrieval fee per GB, 128 KB minimum billable size |
| One Zone-IA | about $0.01 | 30 days | tens of ms | Single zone: lost if that zone is destroyed |
| Glacier Instant Retrieval | about $0.004 | 90 days | milliseconds | Higher retrieval fee, for data read about quarterly |
| Glacier Flexible Retrieval | about $0.0036 | 90 days | minutes to hours | Expedited 1-5 min, standard 3-5 h, bulk 5-12 h |
| Glacier Deep Archive | about $0.001 | 180 days | within 12 hours (bulk up to 48 h) | Cheapest; compliance archives |
| Express One Zone | higher than Standard | none | single-digit ms | Directory buckets in one zone, for latency-sensitive analytics and ML |
Worked example: 1 PB of media originals.
- In Standard: about 1,000,000 GB × $0.023 ≈ $23,000 a month.
- After 30 days the originals are rarely read, so moving them to Standard-IA costs about $12,500 a month.
- Moving to Glacier Instant Retrieval costs about $4,000 a month, which saves over $200,000 a year.
Retrieval changes the picture. Reading 50 TB a month back from Glacier Instant Retrieval at around $0.03 per GB adds about $1,500, which is still cheap. Reading half the archive every month would erase the saving. Tiering pays off only when the access pattern really is cold.
Traps in the fine print.
- Minimum durations. An object deleted after 10 days in Standard-IA is billed for 30. Short-lived data belongs in Standard.
- Minimum object size. IA classes bill small objects as 128 KB. A million 4 KB thumbnails in Standard-IA cost as if they were 128 GB, not 4 GB.
- Per-object transition fees. Lifecycle transitions are billed per request. Moving 1 billion tiny objects to Glacier can cost more in transition fees than years of storage savings. Pack small objects into archives before tiering them.
- Glacier per-object overhead. Glacier Flexible Retrieval and Deep Archive add about 40 KB of index and metadata overhead per object, partly billed at Standard rates.
Intelligent-Tiering. For data with unknown access patterns, Intelligent-Tiering monitors each object. It moves objects to an infrequent tier after 30 days without access and to an archive-instant tier after 90 days, and back on access, with no retrieval fees. A small per-object monitoring fee applies, and objects under 128 KB are not tiered. It is a sensible default for data lakes and user content where you cannot predict reads.
Requests and egress often dominate. PUT, COPY, POST and LIST cost about $0.005 per 1,000, and GET about $0.0004 per 1,000, in Standard. A workload making 10,000 small reads a second makes 864 million GETs a day, which costs about $350 a day in requests alone, whatever the stored size. Data transfer to the internet costs several cents per GB, so serving 1 PB a month directly from the bucket would cost tens of thousands of dollars. That is why media is served through a CDN, whose cached hits avoid origin egress, and why providers with low or zero egress fees, such as Cloudflare R2, attract media-heavy workloads.
Lifecycle design checklist.
- Transition originals by age.
- Expire temporary prefixes.
- Expire noncurrent versions after a recovery window.
- Abort incomplete multipart uploads.
- Use tags for data whose retention depends on business state, for example "account closed".
Test rules on a small prefix first. A wrong expiration rule is a mass deletion that versioning can only undo if noncurrent versions are retained.
Access control and encryption#
Who can touch an object. Access to S3 is decided by combining several policy layers. A request is allowed only if some policy allows it and no policy explicitly denies it.
- IAM policies attach to users and roles.
- Bucket policies attach to the bucket, for example "only the CDN's origin identity may read" or "deny any request not using TLS".
- Block Public Access settings at the account and bucket level override everything that would make data public.
- ACLs are a legacy mechanism. New buckets disable them by default with the "bucket owner enforced" setting.
For multi-tenant applications, the tenant boundary usually lives in the application. The app decides which keys a user may access and mints presigned URLs only for those keys. It does not create cloud credentials per end user.
Encryption at rest. S3 encrypts all new objects by default, using server-side encryption with S3-managed keys (SSE-S3) since January 2023. The options differ in who controls the key:
- SSE-S3: AWS manages the keys entirely. No extra cost, and no per-request key calls.
- SSE-KMS: keys live in AWS KMS. You get key policies, audit logs of every use, and the ability to revoke access by disabling a key. Each request calls KMS, which adds latency and cost, and KMS request quotas can throttle very busy buckets. S3 Bucket Keys reduce those calls by deriving a short-lived bucket-level key.
- SSE-C: the client supplies the key with every request, and S3 does not store it. Lose the key and the data is unrecoverable.
- Client-side encryption: data is encrypted before upload, so the provider never sees plaintext. The cost is that server-side features such as range reads of compressed columns, or in-place processing, stop working on the ciphertext.
Encryption in transit and auditing. Enforce TLS with a bucket policy condition on aws:SecureTransport. Log data access with CloudTrail data events or server access logs. Review public or cross-account access with tools such as IAM Access Analyzer. Most real-world object storage breaches come from misconfigured public access, not broken cryptography, so the account-wide public-access block is the single most valuable setting.
Use cases#
- Media: user photos and videos, transcoded renditions and thumbnails, served through a CDN. See CDN.
- Static websites and assets: HTML, JavaScript, CSS and downloads.
- Backups and archives: database snapshots, logs, compliance records, with versioning and object lock (write-once-read-many) against deletion or ransomware.
- Data lakes: raw and processed data in columnar formats (Parquet) with table formats (Apache Iceberg, Delta Lake), queried by Spark, Trino or Athena directly from storage.
- ML datasets and model artefacts, and large attachments in chat and email systems.
Use cases in depth#
Media pipelines. A typical photo or video product chains object storage, events and a CDN.
Originals stay private and immutable, so they can always be re-processed when a new codec or size is needed. Renditions use content-addressed or versioned keys, so CDN caches can hold them for a year with no invalidation. A video becomes many objects: HLS or DASH playlists plus thousands of segments of 2-6 seconds each, which players fetch in sequence through the CDN.
Data lakes and lakehouses. Analytical data lives in object storage as columnar files, typically Parquet or ORC of 128 MB to 1 GB each, organised by partition prefixes such as events/dt=2026-12-01/. Object storage decouples storage from compute, so Spark, Trino, Athena, Snowflake external tables and DuckDB can all read the same files, and compute clusters can scale to zero.
Plain folders of files have problems. There are no atomic multi-file commits, listing millions of files is slow, and schema changes are messy. Table formats fix this:
- Apache Iceberg was created at Netflix.
- Delta Lake came from Databricks.
- Apache Hudi came from Uber.
All three keep metadata files that list exactly which data files form each table snapshot. That gives atomic commits, time travel, schema evolution and partition pruning without listing. Their big operational task is compaction. Streaming ingestion creates many small files, and engines run best with fewer large ones, so background jobs rewrite small files into large ones. See Batch and Stream Processing.
Backups and compliance. Database snapshots, WAL archives and log exports go to object storage, often in a separate account, so compromised production credentials cannot delete them. Object Lock adds write-once-read-many (WORM) protection.
- In governance mode, specially privileged users can still remove locks.
- In compliance mode, nobody can delete or shorten the retention before it expires, not even the root account. That mode exists for regulations such as SEC 17a-4.
- A legal hold keeps an object indefinitely until the hold is lifted.
Combined with versioning and cross-region replication, this is the standard ransomware defence for backups.
Static sites and software distribution. Static site builds, JavaScript bundles, container image layers (registries store layers as blobs keyed by digest), package repositories, and game patches are all immutable, content-addressed blobs. They are a perfect fit, usually behind a CDN.
ML and AI workloads. Training datasets of images, text shards and embeddings, plus model checkpoints of tens to hundreds of GB, live in object storage. Training jobs read with many parallel range GETs, and low-latency classes such as S3 Express One Zone, or caching layers, keep GPUs busy. Checkpoints use multipart uploads, and the manifest pattern marks a checkpoint complete only after all shards land.
Logs and event archives. Services and streaming platforms offload old data to object storage: log shippers, CDN logs, Kafka tiered storage, and time-series databases that move old blocks to S3. The hot tier stays small and fast, and object storage holds the long tail cheaply.
When not to use object storage#
- Small, frequently updated records: each update rewrites the whole object, and requests cost money and tens of milliseconds. Use a database.
- Queries over contents or metadata: there is no "find all objects where owner = 42"; keep an index in a database.
- Low-latency random access inside files (databases, VM disks): use block storage.
- POSIX file semantics (renames, appends, locks) for legacy apps: use a file system service, or a FUSE layer with care.
- Millions of tiny objects (under ~100 KB) read individually: per-request cost and latency dominate; pack them into larger files.
When not to use it, in depth#
Latency and request cost. A Standard-class GET of a small object typically takes tens of milliseconds to the first byte, with a long tail to hundreds of milliseconds. A database point read takes about 1 ms, and a Redis read takes well under 1 ms. A request path that reads ten small objects in sequence spends 300 ms or more just waiting. Per-request pricing punishes tiny, chatty access. Storing 10 million session records of 1 KB as objects and updating each once a minute would cost about $3,000 an hour in PUT requests. That is 10 million writes a minute at $0.005 per 1,000. A key-value database is orders of magnitude cheaper for that pattern.
Rough decision table.
| Need | Use | Why |
|---|---|---|
| Large immutable files, write once, read many | Object storage | Cheap, durable, scales without limit |
| Small records, frequent updates, queries | Database (SQL, DynamoDB) | In-place updates, indexes, transactions |
| Sub-millisecond reads of hot data | Cache (Redis, Memcached) | Memory speed |
| Block device for a database or VM | Block storage (EBS, Persistent Disk) | Random 4-16 KB I/O at sub-millisecond latency |
| Shared POSIX file system | File storage (EFS, Filestore, FSx, NFS) | Renames, appends, locks, directories |
| Append-only event stream with consumers | Log (Kafka, Kinesis) | Ordering, offsets, replay |
File system emulation is partial. Tools such as Mountpoint for Amazon S3 (2023), s3fs and gcsfuse let programs read buckets as if they were directories. They map reads well, but cannot offer real renames (a directory rename is a copy and delete of every object), appends, file locks, or random writes into existing files. Use them for read-heavy tools that expect files, not as a disk for a database.
Small-file workloads. If the natural unit is tiny, such as sensor readings, chat messages or thumbnails under 10 KB read individually at high rates, either pack many items into larger objects with an index, or use a database or cache. The rule of thumb in the large-blobs pattern still holds. Data over about 10 MB that needs no SQL queries belongs in blob storage, and small structured records belong in a database.
When to Use It#
- Any file or blob larger than a few hundred KB, especially user uploads and media.
- Backups, logs and anything retained for months or years.
- Analytics data shared by several processing engines.
- Static content served through a CDN.
When NOT to Use It#
- As a database for structured, queryable or frequently changing data.
- For workloads that need sub-millisecond latency or in-place writes.
- For many tiny objects accessed one at a time at very high rates.
How to Implement It#
- Store blobs in object storage, metadata in a database: the row holds the key, size, type, owner and status.
- Use presigned URLs for direct client uploads and private downloads; keep buckets private by default.
- Use multipart upload for files over about 100 MB, with parallel parts and retries.
- Design keys with high-cardinality prefixes (user ID or a hash) to spread load.
- Enable versioning and, for critical data, cross-region replication and object lock.
- Add lifecycle rules for tiering, expiry and aborting incomplete uploads.
- Serve public or hot content through a CDN, with the bucket as origin.
| Technology | Fits when |
|---|---|
| Amazon S3 | The default; widest ecosystem and S3 API compatibility |
| Google Cloud Storage, Azure Blob Storage | Workloads on those clouds |
| Cloudflare R2, Backblaze B2 | S3-compatible storage with lower or no egress fees |
| MinIO, Ceph (RGW) | Self-hosted, on-premises or edge S3-compatible storage |
Trade-offs#
| Choice | Gain | Cost | Pick when |
|---|---|---|---|
| Object storage | Unlimited scale, high durability, cheap | Higher latency, whole-object writes, no queries | Files, media, backups, lakes |
| Replication | Fast reads and repair | 3x storage | Hot or small objects |
| Erasure coding | ~1.4x storage for high durability | Costlier reads during failures and repair | Large, cold data |
| Infrequent/archive classes | Much lower storage cost | Retrieval fees and delays, minimum durations | Rarely read data |
| Presigned direct upload | App servers skip the bytes | Upload confirmation and validation work | Any user uploads |
| Versioning on | Recovery from overwrites and deletes | Every version is billed; needs noncurrent-version expiry | User content, backups, configs |
| Intelligent-Tiering | Automatic savings without predicting access | Per-object monitoring fee, small objects not tiered | Data lakes, unpredictable reads |
| Cross-region replication | Survives a regional outage, local reads | Double storage, transfer fees, async lag | Critical or globally read data |
| Packing small objects | Far fewer requests and transitions | An index of offsets, harder deletes | Thumbnails, sensor data, tiny files |
Common Pitfalls#
- Public buckets exposing private data; keep buckets private and use presigned or signed CDN URLs.
- Proxying all uploads through application servers.
- Forgetting incomplete multipart uploads, which keep costing money.
- Listing objects to find data instead of keeping an index in a database.
- Ignoring egress cost: serving heavy media directly from the bucket instead of a CDN.
- Using the ETag of a multipart upload as the file's MD5.
- Keys that begin with a timestamp, concentrating load on one key range.
- Tiering billions of tiny objects and paying more in transition fees than is saved.
- Trusting the declared content type instead of scanning and validating uploads.
- Overwriting objects in place behind a CDN, then serving stale bytes until caches expire.
Real-World Examples#
Amazon S3, launched in 2006, is designed for 99.999999999% durability and, since December 2020, provides strong read-after-write consistency for all operations.
Netflix has described storing its media assets and large amounts of data on S3, with content delivered to viewers through its Open Connect CDN.
Facebook's Haystack (OSDI 2010) and f4 (OSDI 2014) papers describe storing hundreds of billions of photos by packing them into large volume files, and later moving warm photos to erasure-coded storage to reduce the replication factor.
Dropbox described its Magic Pocket project (2016), moving most user data from Amazon S3 into its own exabyte-scale object storage system built on erasure coding.
In the Interview#
Handling object storage questions in an interview#
State the split in one sentence. "Bytes go to object storage, metadata goes to the database, and the client talks to storage directly with presigned URLs." Most interviewers want to hear exactly this early in any design with uploads, and it frees time for deeper points.
Size it. For example, take 10 million uploads a day at 3 MB average. That is 30 TB a day, about 11 PB a year before replication, and about 115 uploads a second on average with peaks of a few hundred. The object store handles that request rate trivially. The interesting parts are cost (tiering after 30 days), egress (a CDN), and processing (a queue of transcoding jobs). Saying where the real constraint sits shows judgement.
Know the failure stories.
- Upload fails at 99%. Multipart with per-part retries, resumed via the upload ID and
ListParts. The lifecycle rule aborts stale uploads. - Client never confirms. The object-created event marks the row uploaded. A sweeper reconciles rows stuck in
uploading. - Duplicate events. Use idempotent processing keyed by key plus version.
- Region outage. Cross-region replication of critical buckets, with clients or the CDN failing over to the replica bucket. Accept the replication lag.
Expect these follow-ups:
- "How do you stop users uploading 50 GB or malware?" Signed size and type, presigned POST policy limits, a quarantine bucket, scanning, and quotas checked at presign time.
- "How are downloads fast worldwide?" A CDN with signed URLs or cookies, immutable versioned keys with long cache lifetimes, and range requests for large files.
- "How does S3 get eleven nines?" Erasure coding or replication across zones, checksums with scrubbing, and fast repair. Durability is not availability, and neither one is a backup.
- "Why not store images in Postgres?" Bloated backups and replication, buffer cache pollution, and the app server in the data path. Keep only the key and metadata in the row.
Red flags: public buckets, app servers proxying gigabytes, listing buckets on the request path, and treating durability as protection against your own deletes.
Deep Dive: Durability maths, metadata scale and small-object packingShow
Durability numbers. Eleven nines means that, on average, if you store 10 million objects you might expect to lose one every 10,000 years. The number comes from modelling disk failure rates, time to detect and repair, and the independence of failure domains. The weakest link is usually correlated failure (a firmware bug, a power event) or operator error, which is why systems spread data across zones and roll out changes slowly.
Metadata is the hard part. Storing bytes is relatively easy; a strongly consistent, highly available index of trillions of keys that supports fast LIST by prefix is not. Metadata stores are sharded by key range, replicated with consensus or quorum protocols, and cached heavily.
Small objects. Each object carries fixed metadata and per-request overhead. Systems that store huge numbers of small files (photos, thumbnails) often pack them into large container files with an index of offsets, so one disk read fetches one photo. Facebook's Haystack paper (2010) described this approach for photo storage.
Egress economics. Storage is cheap, but data transfer out of a cloud region often costs more than storing the data for months. CDNs, regional caches and providers with low egress fees all change the bill for media-heavy products.
Deep Dive: Building the metadata and garbage-collection layers of an object storeShow
Why metadata dominates the design. Take 1 trillion objects with about 300 bytes of metadata each, covering the key, version, size, checksums, location list and ACL pointer. That is 300 TB of metadata, more than any one machine holds, and it is accessed for every request. It must be strongly consistent, because S3-style read-after-write semantics depend on it, sorted by key for LIST, and spread across many partitions. Typical designs use a range-partitioned, replicated key-value store, with Paxos or Raft per partition or chain replication, and automatic splits and merges as ranges heat up or grow. A cache tier in front absorbs hot GET and HEAD traffic. The cache must be kept coherent with writes, which is the hard part of offering strong consistency at scale.
Versioned rows and atomic commit. Each key maps to a list of versions. A PUT appends a version row pointing at new chunk locations, in one atomic operation on one partition, so concurrent writers to a key serialise at the partition leader. Conditional writes (If-None-Match, If-Match) are evaluated in the same step. This is why single-key compare-and-swap is cheap, and why multi-key transactions, which would span partitions, are not offered.
Garbage collection. Chunks become garbage when a version is overwritten in an unversioned bucket, when versions are deleted or expired, and when uploads are abandoned. Reclaiming them safely has three parts.
- Reference tracking. Either the metadata layer emits "chunk released" records when a version is deleted, or a periodic mark phase scans metadata to build the set of live chunks.
- Grace period. Chunks are reclaimed only after a delay, so in-flight reads of a just-deleted version, and uploads that have written chunks but not yet committed metadata, are not broken.
- Sweep. Storage nodes delete or compact unreferenced chunks. Log-structured nodes reclaim space by rewriting extents that are mostly dead, which costs I/O, just as compaction does in LSM trees (see Storage Engines).
A GC bug that deletes live data is the nightmare scenario. Production systems therefore use several defences. They require two independent signals before deleting. They keep "soft-deleted" data for days. They have formally checked or extensively fuzzed the reclamation logic, as the ShardStore paper describes for crash consistency.
Repair scheduling. When a disk dies, every chunk on it needs rebuilding. A 20 TB disk holds millions of fragments whose peers are spread across thousands of other disks. That spread means the rebuild can run in parallel across the fleet and finish in hours rather than the days a single-disk rebuild would take. Repair is prioritised by risk. An object that has lost 3 of its 4 spare fragments is rebuilt before one that has lost 1. Repair traffic is rate-limited so it does not starve customer traffic.
Placement and heat. New data is hot, and old data is cold. If placement filled only the newest disks, those disks would take all the writes and most of the reads. Placement therefore balances by both free space and recent load, and rebalancing gradually moves data to keep heat spread. At very large scale, as AWS engineers have described publicly, aggregate load from millions of customers becomes smooth and predictable even though each customer's traffic is bursty. This "workload decorrelation" is one reason a huge shared object store can offer high per-customer throughput at low cost.
Key Takeaways#
- Object storage keeps immutable objects (data plus metadata) under keys in buckets, accessed by HTTP, at practically unlimited scale.
- Durability comes from replication (3x) or erasure coding (~1.4x), with checksums and background repair.
- S3 now offers strong read-after-write consistency per object, but no multi-object transactions.
- Presigned URLs let clients upload and download directly; multipart upload makes large uploads parallel and resumable.
- Use storage classes and lifecycle rules to cut cost, and keep queryable metadata in a database, not in the bucket.
- Keys are the only index: design them for listing and load spread, and keep searchable metadata in a database.
- Writes commit atomically through metadata after chunks are durable; GC reclaims the rest later.
- Erasure coding gives eleven-nines durability at 1.3-1.5x overhead; LRC cuts repair cost; correlated failures are the real risk.
- Strong per-object consistency, no multi-object transactions: commit with manifests or conditional writes.
- Cost = storage + requests + retrieval + egress; tier cold data, pack small objects, and serve through a CDN.