S3 buckets, objects and consistency
What object storage is: buckets, keys and prefixes, strong read-after-write consistency, conditional writes, request rates and naming.
Regions, endpoints, ARNs and service scopeThe AWS CLI, SDKs and credential profiles
S3 buckets, objects and consistency
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- S3 is a key-value store for whole objects, reached over HTTP. There are no real directories, no appending and no editing bytes in place in a general purpose bucket.
- A prefix is just the leading characters of a key. A list request with a delimiter groups keys so they look like folders.
- Reads, lists and overwrites are strongly consistent: after a successful write, every later read sees it. Bucket configuration changes are only eventually consistent.
- Concurrent writes to one key are last-writer-wins unless you use conditional writes, If-None-Match to create only and If-Match to replace only an unchanged object.
- Request rate scales per partitioned prefix, at least 3,500 writes and 11,000 reads per second, and S3 may return 503 Slow Down while it splits.
- A bucket name is either global across the partition or reserved to your account and Region with the -an suffix. Prefer names nobody else can claim.
The problem with disks
A disk gives you blocks. A filesystem on top gives you files, directories, seek and append. Both are great until you want to keep every photo users ever upload, survive the loss of a data centre and never resize a volume. Then someone has to manage capacity, replication and backups.
Object storage gives up some filesystem features to make all of that somebody else’s job. You hand S3 a blob and a name over HTTPS. S3 stores it redundantly and gives it back when you ask by name. There’s no volume to size and no server to patch. Think of a coat check: you hand over the whole coat, get a ticket, and collect the whole coat. You don’t sew a button on while it’s on the rail.
Buckets, keys and objects
A bucket is a container created in one Region. An object is the bytes plus metadata: content type, size, an ETag, your own headers and optional tags. A key is the object’s full name inside the bucket, such as reports/2026/11/summary.txt.
That slash means nothing to S3. The namespace is flat. What looks like folders comes from the list API: give it a delimiter and it rolls keys up into “common prefixes”. I put three objects into a bucket on a local emulator and listed with --delimiter /:
$ aws s3api list-objects-v2 --bucket shop-assets-demo --delimiter /
Keys: logo.txt
Prefixes: reports/
$ aws s3api list-objects-v2 --bucket shop-assets-demo --prefix reports/2026/1
reports/2026/10/summary.txt
reports/2026/11/summary.txt
The second call shows a prefix is only leading characters. reports/2026/1 matches both October and November.
This has consequences. Renaming a “folder” means copying and deleting every object under it. In a general purpose bucket you can’t append to an object or change bytes in the middle. You write a new object over the old key. (Directory buckets, used by the S3 Express One Zone storage class, behave differently and are a specialist tool.)
One PUT carries up to 5 GB. Larger objects go up in parts, up to 50 TB, covered in multipart and direct uploads.
What a reader can see
S3 gives strong read-after-write consistency for object writes and deletes in all Regions. Once a PUT or DELETE returns success, every later GET, HEAD and list reflects it. Updates to one key are atomic: a reader gets the old object or the new one, never a mix.
Older material says overwrites are eventually consistent. That stopped being true in December 2020. Bucket configuration, such as enabling versioning or changing a policy, is still eventually consistent, so don’t flip a setting and assume it applies everywhere instantly.
Strong consistency doesn’t mean locking. If two clients write the same key at once, the later write wins and nobody is told. There are also no transactions across keys. If you need several things to change together, keep the pointer to them in a database, or write a single manifest object last. Consistency patterns covers the general ideas.
Conditional writes
You can ask S3 to check a precondition as part of the write:
$ aws s3api put-object --bucket shop-assets-demo --key logo.txt \
--body b.txt --if-none-match '*'
An error occurred (PreconditionFailed) ...
$ aws s3api put-object --bucket shop-assets-demo --key logo.txt \
--body b.txt --if-match '"deadbeef"'
An error occurred (PreconditionFailed) ...
If-None-Match: * means “only if this key doesn’t exist”. If-Match with the current ETag means “only if nobody changed it since I read it”. The second is optimistic concurrency: read, modify, write back conditionally, and start again on failure. When I passed the real ETag, the write went through. A bucket policy can require these headers so a careless client can’t overwrite.
Keys and throughput
S3 scales by splitting the keyspace. Each partitioned prefix supports at least 3,500 PUT/COPY/POST/DELETE or 11,000 GET/HEAD requests per second, and the number of prefixes isn’t capped. Splitting happens gradually, so a sudden spike can get 503 Slow Down. SDKs retry with backoff, and spreading load across prefixes raises the ceiling. Slashes alone add nothing.
Naming buckets
By default a bucket name is unique across all accounts in a partition, and when you delete it, someone else may take it. Anything still pointing at the old name now talks to a stranger. S3 also offers account regional namespace buckets, named prefix-accountid-region-an, which only your account can create. Use those where available, or add a random suffix. A bucket’s name and Region can’t be changed later. The default quota is 10,000 general purpose buckets per account, but you rarely want many: one per application and environment, with prefixes inside, is a sane start.
About the video
The embed is Jordan has no life’s 18-minute “Amazon S3 (Object Stores) - In Practice” from June 2025. Its chapters go from what an object store is, through its architecture, consistency, presigned URLs, multipart uploads and prefix partitioning, to pricing. It’s a system-design view by one engineer, not official AWS material, and the later topics get their own lessons here. I judged it from chapters and metadata only, since transcripts couldn’t be fetched.
What was run: the list, prefix and conditional-write commands ran against moto 5.1.22, a local AWS emulator, so they show the shape of the API, not AWS itself. Consistency, limits, request rates and namespaces come from the S3 user guide, checked in November 2026.
Check yourself
You upload a new version of config.json and another process reads it a millisecond after your PUT returns success. What does it get?
The new version. S3 gives strong read-after-write consistency for object PUTs and DELETEs, including overwrites, so a read that starts after the successful write returns it.
Two workers each try to create the key locks/job-7 and only one should win. How do you do it without a database?
Both send PutObject with If-None-Match set to an asterisk. S3 accepts one and rejects the other because the key already exists. The loser treats that error as losing the race.
A script renames a folder of 100,000 objects in a general purpose bucket. Why is it slow and not atomic?
There is no folder. Each object has to be copied to a new key and the old key deleted, one request each, so readers can see a half-renamed state.
Your batch job starts sending 30,000 PUTs per second under one new date prefix and sees 503 errors. What is happening?
S3 scales request rate by partitioning prefixes, and it does so gradually. Retry with backoff, and spread writes over several prefixes so more partitions can work in parallel.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.