A warehouse of labelled boxes
Picture a huge storage warehouse on the edge of town. You rent a room there and paint a name on its door. Nobody else can use that name, so the name alone finds your room.
To store something, you seal it in a box, write a label on it ("2024/cat.jpg") and hand it in at the front desk. To get it back, you just say the label. The desk doesn't care what's inside: photos, videos, old letters.
There are no cupboards inside the room. "2024/cat.jpg" is simply one long label. When you ask for every box whose label starts with "2024/", it feels like opening a cupboard called 2024, but you're only matching the start of the label, called a prefix.
This isn't like the filing cabinet in your office, where you pull out a drawer and change one page. At the warehouse you never open a box on the shelf. You hand in whole boxes and get whole boxes back. In return, the warehouse never runs out of room.
Buckets, objects and keys
Amazon S3 (Simple Storage Service) is object storage. You create a bucket in a Region and store objects in
it. An object is the data plus metadata (content type, user metadata, tags), addressed by a key such as
2024/cat.jpg. Since December 2025 an object can be up to 50 TB in most Regions; earlier the limit was 5 TB. Everything goes through an
HTTP API: PutObject, GetObject, DeleteObject, ListObjectsV2.
By default, bucket names share one global namespace, so a name must be unique across all AWS accounts in the partition. Since March 2026 you can instead create a bucket in your account-regional namespace, where the name carries your account id and Region and only your account can use it.
The key space is flat. / is just a character in the key; there are no directories. The console shows "folders" by
grouping keys: ListObjectsV2 with prefix=2024/ and delimiter=/ returns matching keys plus CommonPrefixes for the
next level down. "Renaming a folder" therefore means copying and deleting every object under that prefix.
| Block storage (EBS) | File storage (EFS) | Object storage (S3) | |
|---|---|---|---|
| Unit | Fixed-size blocks | Files in a directory tree | Whole objects under flat keys |
| Access | A disk attached to an instance | Mounted over NFS by many hosts | HTTP API from anywhere |
| Changing data | Rewrite any block in place | Edit, append, lock files | Replace the whole object |
| Scale | Provisioned size | Grows with use | Practically unlimited |
Swap the whole box, see it at once
Ana wants to update her report. She can't open the box on the shelf and fix one page. She hands in a new box with the same label, and it takes the old one's place.
The moment the desk says "stored", anyone who asks for that label gets the new box straight away. Nobody is ever handed the old one by mistake, or half of the new one. This promise is called strong consistency.
If two people hand in boxes with the same label at the same moment, the desk doesn't make one wait. The one that arrives last is the one that stays.
Whole objects and strong consistency
A PutObject to an existing key replaces the whole object atomically. A reader sees either the old object or the new
one, never a mix or a partial upload. General purpose buckets have no in-place edit or append: to change one byte,
upload the object again.
Since December 2020, S3 provides strong read-after-write consistency automatically, at no extra cost: after a successful PUT of a new object, an overwrite or a delete, every later GET, HEAD or LIST reflects it. Before that, overwrites and deletes were only eventually consistent, which is why older code is full of retry-until-visible loops.
There is no locking. Two concurrent PUTs to one key both succeed and the one with the later timestamp wins. To avoid lost
updates, use conditional writes: If-None-Match: * creates an object only if the key is free, and If-Match with
the ETag you read replaces it only if nobody has changed it since. A failed condition returns 412 Precondition Failed.
Bucket settings are different. The strong consistency promise covers objects. Bucket-level configuration, such as deleting a bucket or turning on versioning, can take a short while to propagate (AWS advises waiting up to 15 minutes after first enabling versioning before writing), so don't create, delete and recreate buckets on a hot path.
Three buildings, one front desk
The warehouse is really three buildings in different parts of town. Every box you hand in is copied into all three before the desk says "stored". If one building floods, your box is still safe in the other two.
That's a promise about keeping your box, and the warehouse makes it very strongly: you would almost never lose one.
Whether the desk can serve you right now is a separate promise. Very rarely the desk is swamped and says "come back in a moment". Your box is fine, you just ask again. Keeping boxes safe is called durability; being open when you ask is called availability.
Durability versus availability
Durability is the chance an object is not lost. Availability is the chance a request succeeds when you make it. S3 Standard is designed for 99.999999999% (eleven nines) durability and 99.99% availability over a year, and its SLA offers service credits when monthly uptime falls below 99.9%.
Durability comes from storing every object redundantly on multiple devices across at least three Availability Zones (separate data centres in a Region) before the PUT returns success, and from continuous checksumming and repair. One Zone classes keep data in a single AZ: cheaper, but an AZ loss can lose the data.
Availability failures look like 500 Internal Error or 503 Slow Down. Each partitioned prefix supports at least
3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD requests per second, and S3 adds partitions gradually as load grows,
returning 503 Slow Down while it scales. The SDKs retry these with exponential backoff.
Eleven nines protects against hardware failure, not against you. A buggy job that deletes objects deletes them durably. That's what versioning is for.
Old boxes and cheaper shelves
You can ask the warehouse to keep every old box. When Ana hands in a new report, the old one moves to a shelf behind it instead of being thrown away. If someone says "throw it out", the clerk just sticks a "removed" card in front, and the boxes behind are still there.
Shelves cost different amounts. The front shelves are quick to reach and cost the most rent. The back room is cheaper, but you pay a small fee each time you fetch from it. The deep vault in the basement is very cheap, but fetching a box takes hours.
You don't have to move boxes yourself. You leave the clerks a note: "after 30 days, move old boxes to the back room; after six months, to the vault; after seven years, throw them out." That note is a lifecycle rule.
Versioning, storage classes and lifecycle
With versioning enabled on a bucket, every PUT to a key creates a new version with its own version id, and the previous one becomes noncurrent. A DELETE without a version id adds a delete marker: GET now returns 404, but the older versions remain, and deleting the marker brings the object back. Deleting a specific version id removes it for good. Once enabled, versioning can be suspended but never turned off, and every version is billed.
Each object has a storage class:
| Class | Use | Notes |
|---|---|---|
| S3 Standard | Frequently read data | Millisecond access, at least 3 AZs |
| S3 Intelligent-Tiering | Unknown or changing patterns | Moves objects between tiers by access, small monitoring fee |
| S3 Standard-IA | Read rarely, needed fast | Per-GB retrieval fee, 30-day minimum |
| S3 One Zone-IA | Re-creatable, rarely read | One AZ only, per-GB retrieval fee, 30-day minimum |
| S3 Glacier Instant Retrieval | Archives read about once a quarter | Milliseconds, 90-day minimum |
| S3 Glacier Flexible Retrieval | Archives | Restore takes minutes to hours, 90-day minimum |
| S3 Glacier Deep Archive | Long-term retention | Restore takes hours, 180-day minimum |
Objects in Glacier Flexible Retrieval and Deep Archive must be restored with RestoreObject before a GET works.
Deleting before the minimum duration still bills the remaining days.
A lifecycle configuration applies rules, filtered by prefix, tags or size: Transition actions change the storage
class after N days, Expiration expires current versions (in a versioned bucket it adds a delete marker rather than deleting data), NoncurrentVersionTransition and
NoncurrentVersionExpiration handle old versions, and AbortIncompleteMultipartUpload cleans up abandoned uploads.
Rules run asynchronously, so an object may stay in its old class for a while after it qualifies.
Locked rooms, a rule sheet and visitor passes
Every room starts locked, with a big sign on the door: "no strangers, ever". Even if someone writes a rule by mistake that would let the whole street in, the sign wins.
On the door is a rule sheet: "Ana's helper may fetch boxes. Nobody may throw boxes out." The clerk checks it on every visit.
To let a friend pick up one box without giving them a key, Ana's helper writes a visitor pass and signs it. It names one box and runs out after 15 minutes. The clerk checks the helper's signature and lets the friend do exactly what the helper may do with that box, nothing more. That pass is a presigned URL.
Access control
Buckets and objects are private by default. A request is allowed only if a policy allows it and nothing explicitly
denies it; an explicit Deny always wins.
- Block Public Access: four settings, at account or bucket level, that override any policy or ACL that would make data public. Since April 2023 new buckets have it turned on, and ACLs disabled (Object Ownership "bucket owner enforced"), by default.
- IAM policies attached to users and roles say what that identity can do. Bucket policies are JSON
resource policies on the bucket, and can grant other accounts or require conditions such as TLS
(
aws:SecureTransport). - New objects are encrypted at rest with SSE-S3 by default; SSE-KMS adds key-level access control and audit.
A presigned URL is a normal S3 URL carrying a SigV4 signature in its query string. Anyone holding it can perform that one operation, on that one key, with the signer's permissions, until it expires: at most 7 days, and sooner if the signing credentials are temporary (a role's session ends, and the URL stops working with it). Presigned PUTs let browsers upload straight to S3 without passing through your servers.
1try (S3Presigner presigner = S3Presigner.create()) {2PresignedGetObjectRequest pass = presigner.presignGetObject(r -> r3.signatureDuration(Duration.ofMinutes(15))4.getObjectRequest(g -> g.bucket("invoices-shop").key("2024/inv-42.pdf")));5URL url = pass.url(); // hand this to the browser6}
Huge boxes in numbered crates
Some things are far too big to carry to the desk in one trip. So you tell the desk you'll send it in pieces, get a ticket number for the job, split it into numbered crates and send several helpers at once. If one helper drops a crate, only that crate is sent again.
When every crate has arrived, you tell the desk "that's all: crates 1, 2 and 3", and the clerks join them into one box on the shelf. Until you say so, there is no box yet. If you never say so, the crates just sit there, costing rent, until someone clears them away, so the note for the clerks should say to clear away unfinished crates. That way of sending is called multipart upload.
In a Java program, a ready-made helper does the trips to the desk for you. You give it the room name, the label and the thing to store, and it even splits big things into crates by itself.
Multipart upload and the Java SDK
A single PutObject is limited to 5 GB, and AWS suggests multipart upload from about 100 MB:
CreateMultipartUploadreturns anUploadId.UploadPartsends parts numbered 1 to 10,000, each 5 MiB to 5 GiB (the last part may be smaller). Parts can go in parallel and in any order; each returns an ETag, and a failed part is retried on its own.CompleteMultipartUploadlists the part numbers and ETags. S3 assembles them in part-number order, and only then does the object appear.AbortMultipartUploadthrows the parts away.
Parts of an upload that is never completed or aborted stay stored and billed, invisibly, so every bucket should have an
AbortIncompleteMultipartUpload lifecycle rule.
With the AWS SDK for Java 2.x, S3Client covers the basic calls:
1S3Client s3 = S3Client.builder().region(Region.EU_WEST_1).build();23s3.putObject(PutObjectRequest.builder()4.bucket("photos-ana").key("2024/cat.jpg").contentType("image/jpeg").build(),5RequestBody.fromFile(Path.of("cat.jpg")));67ResponseBytes<GetObjectResponse> cat = s3.getObjectAsBytes(GetObjectRequest.builder()8.bucket("photos-ana").key("2024/cat.jpg").build());9byte[] data = cat.asByteArray();
For large files, S3TransferManager (artifact software.amazon.awssdk:s3-transfer-manager, best on the CRT-based
S3AsyncClient) splits uploads into parts, sends them in parallel and
retries failed parts:
1try (S3TransferManager tm = S3TransferManager.create()) {2tm.uploadFile(u -> u3.putObjectRequest(p -> p.bucket("media-ana").key("videos/movie.mp4"))4.source(Path.of("movie.mp4")))5.completionFuture().join();6}
Credentials come from the default provider chain (environment variables, profile, or the instance or task role), so none appear in code. Clients are thread-safe and meant to be created once and reused.
Streaming downloads: getObjectAsBytes loads the whole object into memory. For big objects use getObject with a
ResponseTransformer that writes to a file, or the returned ResponseInputStream, and close it promptly so the HTTP
connection goes back to the pool.
S3 is not a file system: there's no rename, no append and no lock, and listing a large prefix is paged, 1,000 keys at a time. Store the keys you need to find in a database, and treat S3 as the place the bytes live.