
Amazon S3 Explained Simply: Buckets, Objects, Storage Classes (and How Not to Leak Your Data)
S3 looks simple: you create a bucket and drop files in it. Then come the surprise bills, the confusing storage classes and the buckets made public "just to test." In this post I explain buckets, objects and keys with a simple warehouse analogy, compare the S3 storage classes without the jargon, break down an HTTPS-only bucket policy, and share a checklist of the mistakes beginners make most.
Almost every AWS project I've touched ends up using S3 somewhere. Images for a website, backups, logs, files a user uploads, a static site. It's usually the first AWS service people actually use, and it looks simple: you create a bucket and put files in it.
It is simple, until you get a bill for storage you forgot about, pick a storage class that charges you every time you read a file, or make a bucket public "just to test." In my last post I covered IAM, and S3 is where those permissions actually get put to use.
So here's S3 the way I wish someone had explained it to me: the mental model, the storage classes without the confusion, a real bucket policy, and the mistakes beginners keep making.
The mental model: a warehouse with labeled boxes
Picture a giant warehouse that never runs out of space:
- A bucket is a section of the warehouse you rent. It has a name and lives in one AWS Region (a geographic location, like
us-east-1orsa-east-1in São Paulo).
- An object is a box you store there. It can be a photo, a PDF, a video, a JSON file. Any file.
- A key is the label on the box: the object's full name, like
invoices/2026/november.pdf.
- Metadata is the sticky note on the box: content type, upload date, custom tags.
You don't walk into the warehouse yourself. You ask at the front desk: "give me the box labeled X" or "store this box with label Y." That front desk is the S3 API, and every request goes through IAM to check whether you're allowed.
1. Buckets and objects: the basics that trip people up
Folders don't really exist
This surprises everyone. S3 is object storage, not a file system like the one on your computer. There are no real folders.
invoices/2026/november.pdf is just one long key that happens to contain slashes.The console shows folders to make your life easier, but behind the scenes it's grouping keys by a shared prefix (
invoices/2026/ ). This matters when you write code: you don't "open a folder," you list objects with a prefix.Bucket names must be unique
By default, bucket names live in a global namespace shared by every AWS account in the world. That's why
my-bucket is always taken. Use something specific, like eduardo-portfolio-assets-2026 .How big can a file be?
Huge. A single object can now be up to 50 TB, 10x the old 5 TB limit. For anything large, you upload it in parts with multipart upload, which the AWS CLI and SDKs handle for you automatically.
How safe is my data?
S3 is designed for 99.999999999% durability (people call it "11 nines"). In practice, if you store your data properly, you're not going to lose it because AWS lost a disk. You're far more likely to lose it because you deleted it, which is why versioning exists (more on that below).
2. Storage classes: same S3, different price tags
This is the part that confuses beginners the most, so here's the simple version:
Storage classes trade a cheaper storage price for a more expensive (or slower) way to get your data back.
Every class keeps the same durability and the same API. What changes is the price per GB, how fast you can read the data, whether you pay to read it, and how long you're committed to keeping it.
Storage class | Use it for | Catch |
|---|---|---|
S3 Standard | Data you read often: website assets, app files | Highest price per GB stored |
S3 Intelligent-Tiering | Data with access patterns you can't predict | Small monitoring fee per object |
S3 Standard-IA | Data you rarely read but need fast when you do (backups) | Retrieval fee + 30-day minimum |
S3 One Zone-IA | Rarely-read data you could recreate (thumbnails, copies) | Stored in one Availability Zone only |
S3 Glacier Instant Retrieval | Archives you touch a few times a year, but need in milliseconds | Higher retrieval fee + 90-day minimum |
S3 Glacier Flexible Retrieval | Archives where waiting minutes to hours is fine | Retrieval isn't instant + 90-day minimum |
S3 Glacier Deep Archive | Data you keep for compliance and almost never read | Cheapest, but retrieval takes hours + 180-day minimum |
S3 Express One Zone | Ultra-low latency workloads (ML, analytics) | Single AZ, special "directory buckets" |
(IA = Infrequent Access. An Availability Zone is one or more separate data centers inside a Region.)
The "minimum duration" trap
If you put a file in Standard-IA and delete it after 5 days, you still pay for 30. Glacier classes have 90 or 180 days. Cheap storage only stays cheap if the data actually stays there.
Let AWS move things for you: Lifecycle rules
You don't have to pick one class forever. A Lifecycle rule moves or deletes objects automatically based on their age:
logs/ prefix: after 30 days → move to Standard-IA after 90 days → move to Glacier Flexible Retrieval after 365 days → deleteSet it once and your old logs stop costing Standard prices forever. If you don't want to think about it at all, Intelligent-Tiering does a version of this per object, based on how often each one is actually accessed.
3. Who can access my bucket?
Here's the good news: new buckets are private by default. AWS has tightened the defaults over the last few years:
- Block Public Access is turned on for every new bucket.
- ACLs (Access Control Lists), the old per-object permission system, are disabled by default. The bucket owner owns every object, and access is controlled only by policies.
- Every new object is encrypted at rest automatically, using keys managed by S3 (called SSE-S3, Server-Side Encryption with S3-managed keys).
So if your data leaks from S3 today, it's almost always because someone changed a default. Usually that's a person trying to make something work quickly.
Two ways to grant access
- IAM policies (attached to a user, group or role): "this role can read from bucket X." This is the one from my IAM post.
- Bucket policies (attached to the bucket itself): "this bucket accepts requests from X, under conditions Y." Useful for cross-account access or for rules that apply to everyone.
Both are JSON, and both follow the same rule you already know: an explicit Deny always wins.
A bucket policy worth copying: HTTPS only
This policy blocks any request that isn't using an encrypted connection, no matter who makes it:
json
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyInsecureTransport", "Effect": "Deny", "Principal": "*", "Action": "s3:*", "Resource": [ "arn:aws:s3:::eduardo-portfolio-assets-2026", "arn:aws:s3:::eduardo-portfolio-assets-2026/*" ], "Condition": { "Bool": { "aws:SecureTransport": "false" } } } ]}What's new compared to the IAM policy from last time:
-
Principal: who the statement applies to. IAM policies don't need it, because they're already attached to someone. Bucket policies do."*"means everyone.
-
Condition: an extra check. Here it reads "if the request did NOT come over HTTPS...", and since the effect isDeny, those requests get blocked.
- Two resources: the bucket itself and everything inside it (
/*). Same trap as before: leave one out and the rule only covers half of what you meant.
Because it's an explicit Deny, no Allow anywhere else can override it.
4. Versioning: your undo button
With versioning turned on, S3 keeps every version of an object instead of overwriting it. Upload a new
logo.png and the old one is still there. Delete a file and S3 just adds a delete marker, so you can bring the file back.It costs extra, since you're storing old versions too. That's why the usual combo is versioning + a Lifecycle rule that deletes old versions after, say, 30 days. You get an undo button without paying to keep every version forever.
The beginner mistakes checklist
- Making a bucket public to host a website. For a static site, put Amazon CloudFront (AWS's CDN, a network that caches your content close to users) in front of a private bucket, using Origin Access Control (OAC). The bucket stays private, and only CloudFront can read it.
- Turning off Block Public Access "just to test." Testing turns into production more often than anyone admits.
- Hardcoding access keys in your app to upload files. Use an IAM role, or pre-signed URLs (temporary links that allow one specific upload or download) for files coming from users.
- Putting frequently-read data in Glacier or IA to save money, then paying more in retrieval fees than you saved.
- Never setting Lifecycle rules, so logs and old backups pile up at Standard prices forever.
- No versioning on important buckets. One wrong
aws s3 rm --recursiveand it's gone.
- Treating "folders" as real. Your code lists by prefix, it doesn't open directories.
- Forgetting buckets exist. Check the S3 console and AWS Budgets every now and then. (My post on avoiding surprise AWS bills covers how.)
Wrapping up
S3 boils down to a few ideas:
- Buckets hold objects, identified by keys. Folders are just prefixes.
- Storage classes trade storage price for retrieval cost and speed. Watch the minimum durations.
- Lifecycle rules move and delete data for you, so you don't pay Standard prices for old stuff.
- New buckets are private, ACL-free and encrypted by default. Keep them that way.
- Bucket policies add rules at the bucket level, and an explicit Deny still always wins.
- Versioning is your undo button.
S3 also comes up all over the AWS Certified Cloud Practitioner exam: storage classes, durability and the Shared Responsibility Model. AWS keeps your data durable, but you decide who can reach it.
If you missed it, my previous post on IAM explains the permissions side of everything here. And tell me in the comments: what's the weirdest thing you've ever stored in an S3 bucket? 😄
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article