AWS S3 is probably the most-used AWS service you've never heard of.
Every image you see on most websites? S3.
Every video streamed on Netflix? Originated from S3.
Every backup, every file upload, every piece of static content? Probably S3.
It's so fundamental to modern internet infrastructure that if S3 went down globally (it has, briefly), a significant chunk of the internet would break.
And the beautiful part? It's dead simple to use.
What Is S3?
S3 = Simple Storage Service.
It's object storage in the cloud. You upload files (objects), AWS stores them in containers called "buckets," and you can access them from anywhere on the internet.
Think of it like Google Drive or Dropbox, but:
- Designed for developers
- Infinitely scalable
- Ridiculously cheap
- Programmatically accessible via APIs
You can store literally anything: images, videos, documents, backups, database dumps, log files, entire websites.
New to AWS? Start with AWS storage basics in the beginner's guide.
How S3 Works (The Basics)
1. Buckets
A bucket is a container for objects. Like a folder, but top-level.
Bucket names are globally unique across ALL of AWS. If someone already took "my-bucket," you can't use it.
2. Objects
An object is a file. Can be anything from 0 bytes to 5 TB.
Each object has:
- Key: The filename/path (e.g.,
images/profile/user123.jpg) - Data: The actual file content
- Metadata: Info about the file (content type, upload date, custom tags)
3. Access Control
You control who can access your bucket and objects.
- Public (anyone can access)
- Private (only you)
- Specific permissions (some users can read, some can write)
Warning: Getting this wrong is how companies accidentally leak sensitive data. More on that later.
What You Can Do With S3
1. Host Static Websites
HTML, CSS, JavaScript files? Upload to S3, enable static website hosting, and you've got a website.
No server needed. Fast. Cheap. Scales automatically.
Perfect for portfolios, landing pages, documentation sites.
Learn how to host static websites with S3 and CloudFront CDN for global performance.
2. Store User Uploads
Users uploading profile pictures? Documents? Videos?
Save them to S3. Your app just stores the S3 URL in your database.
Integrate S3 uploads in serverless APIs with Lambda for file handling.
3. Backups and Disaster Recovery
Database backups. Code repositories. Configuration files.
S3 is durable (99.999999999% — eleven nines — durability). Your data won't randomly disappear.
4. Content Delivery
Combine S3 with CloudFront (AWS's CDN) to serve images and videos globally with low latency.
5. Data Lakes
Store massive amounts of raw data for analytics, machine learning, or big data processing.
S3 is the foundation for most AWS data pipelines. Use S3 to store document corpus for RAG systems with embeddings and vector search.
6. Archive Storage
Old files you need to keep but rarely access? S3 Glacier for deep archiving at a fraction of the cost.
S3 Storage Classes (Choosing the Right One)
Not all data is equal. Some you access daily. Some you'll never look at again but legally have to keep.
S3 has different storage classes for different use cases:
S3 Standard
- Fast access
- High durability and availability
- Most expensive
- Use for: Active data (images, videos, frequently accessed files)
S3 Intelligent-Tiering
- Automatically moves data between frequent and infrequent access based on usage patterns
- Small monitoring fee but can save money
- Use for: Data with unpredictable access patterns
S3 Standard-IA (Infrequent Access)
- Cheaper than Standard
- For data accessed less than once a month
- Retrieval fees apply
- Use for: Backups, old content, disaster recovery files
S3 One Zone-IA
- Even cheaper (stored in a single availability zone instead of multiple)
- Less redundancy (higher risk)
- Use for: Reproducible data, secondary backups
S3 Glacier Instant Retrieval
- Long-term archival with instant access
- Cheaper than IA
- Use for: Archives that need occasional immediate access
S3 Glacier Flexible Retrieval
- Archival with retrieval time of minutes to hours
- Very cheap
- Use for: Long-term backups, compliance archives
S3 Glacier Deep Archive
- Cheapest option
- Retrieval takes 12-48 hours
- Use for: Data you legally have to keep but will probably never access
Pro tip: Use S3 Lifecycle Policies to automatically move objects between classes as they age. Old uploads move from Standard to IA to Glacier automatically.
S3 Pricing (Real Numbers)
Storage (per GB per month):
- S3 Standard: 0.023 USD
- S3 IA: 0.0125 USD
- S3 Glacier: 0.004 USD
- S3 Deep Archive: 0.00099 USD
Requests:
- PUT/COPY/POST/LIST: 0.005 USD per 1,000 requests
- GET/SELECT: 0.0004 USD per 1,000 requests
Data Transfer:
- Upload to S3: Free
- Download from S3: First 100 GB/month free, then 0.09 USD per GB
Example:
Storing 100 GB of images (Standard class), accessed 10,000 times per month:
- Storage: 100 GB * 0.023 USD = 2.30 USD
- Requests: 10,000 * 0.0004 USD / 1,000 = 0.004 USD
- Data transfer (assuming 10 GB downloaded): Free (under 100 GB)
Total: ~2.30 USD/month
Compare that to hosting on a VPS or buying physical storage. S3 wins easily.
Common S3 Use Cases (With Code Examples)
1. Upload a File (Python)
import boto3
s3 = boto3.client('s3')
# Upload file
s3.upload_file(
Filename='photo.jpg',
Bucket='my-bucket',
Key='uploads/photo.jpg'
)
2. Generate Presigned URL (Temporary Access)
Give someone temporary access to a private file without making it public.
url = s3.generate_presigned_url(
'get_object',
Params={'Bucket': 'my-bucket', 'Key': 'private-file.pdf'},
ExpiresIn=3600 # URL valid for 1 hour
)
3. List Objects in a Bucket
response = s3.list_objects_v2(Bucket='my-bucket')
for obj in response['Contents']:
print(obj['Key'])
4. Delete an Object
s3.delete_object(Bucket='my-bucket', Key='old-file.txt')
S3 Security (Don't Be That Person on the News)
Every few months, some company makes headlines: "Company Exposes 50 Million User Records in Unsecured S3 Bucket."
Don't be that company.
Security Best Practices:
1. Never Make Buckets Public Unless Necessary
Default should be private. Only make public if you're hosting a website or truly public content.
2. Use IAM Policies
Control access via AWS Identity and Access Management.
Principle of least privilege: give users/apps ONLY the permissions they need.
3. Enable Bucket Versioning
Keeps old versions of files. Protects against accidental deletion or overwrite.
4. Enable Encryption
S3 supports encryption at rest (AES-256) and in transit (SSL/TLS).
Turn it on. There's no reason not to.
5. Use Presigned URLs for Temporary Access
Instead of making files public, generate time-limited URLs.
6. Enable S3 Access Logging
Track who's accessing your bucket. Useful for audits and detecting suspicious activity.
7. Use Bucket Policies and ACLs Carefully
Understand the difference between bucket policies (bucket-level access) and object ACLs (object-level access).
Misconfiguration here is how leaks happen.
8. Enable S3 Block Public Access
AWS has a setting to prevent accidental public exposure. Enable it at the account level.
S3 Performance Tips
1. Use Multipart Upload for Large Files
Files over 100 MB should use multipart upload. Faster and more reliable.
AWS SDKs handle this automatically.
2. Use CloudFront for Frequent Access
If users access the same files repeatedly, serve them via CloudFront (CDN). Faster for users, cheaper for you.
3. Optimize Key Naming for High Request Rates
If you're doing thousands of requests per second, avoid sequential key names (like timestamps).
Use random prefixes or hash-based keys for better distribution.
4. Use S3 Transfer Acceleration
For uploads from distant locations, Transfer Acceleration routes data through CloudFront edge locations for faster uploads.
Common S3 Mistakes
1. Not Using Lifecycle Policies
Storing everything in Standard tier forever. Wastes money.
Set up lifecycle policies to automatically archive old data.
2. Paying for Data Transfer You Could Avoid
Downloading from S3 to EC2 in the same region? Free.
Downloading to your laptop? You pay.
Keep data movement within AWS regions when possible.
3. Storing Millions of Tiny Files
Each request has a cost. Storing 1 million 1 KB files is more expensive (in requests) than storing 1,000 1 MB files.
Consider combining small files if you're dealing with millions of them.
4. Not Monitoring Costs
S3 is cheap until it isn't. Set up billing alerts. Review usage monthly.
5. Forgetting to Delete Old Data
Test files. Temporary uploads. Old backups.
S3 is cheap, but clutter adds up. Clean up regularly.
Alternatives to S3 (For Context)
- Google Cloud Storage: Similar, slightly different pricing
- Azure Blob Storage: Microsoft's version
- DigitalOcean Spaces: Simpler, cheaper for small scale
- Wasabi: S3-compatible, cheaper storage, limited free egress
- Cloudflare R2: Zero egress fees (game changer for high-traffic use)
S3 is the most mature, most integrated, and most widely supported. But it's not the only option.
The Bottom Line
S3 is digital storage that scales infinitely, costs almost nothing, and just works.
It's the foundation of modern cloud infrastructure. If you're building anything on AWS, you'll use S3.
Learn the basics: buckets, objects, storage classes, security.
Set up lifecycle policies. Monitor costs. Don't make your bucket public by accident.
That's it. S3 is powerful but straightforward.
Takeaway: AWS S3 is infinitely scalable object storage for any type of file. Use it for static websites, user uploads, backups, content delivery, and data lakes. Choose the right storage class based on access patterns (Standard for frequent access, IA for occasional, Glacier for archival). Pricing is cheap but watch for data transfer costs. Security is critical — default to private buckets, use IAM policies, enable encryption, and never accidentally expose sensitive data. S3 is the backbone of cloud file storage and probably powers half the websites you visit daily.