Amazon S3 Deep Dive: Buckets, Storage Classes, Versioning, Lifecycle, Replication, Security and Performance
What Is S3?
Amazon Simple Storage Service (S3) is object storage: store any amount of files (objects) in containers called buckets, access them over HTTPS, and pay for what you store and transfer. S3 gives 11 nines (99.999999999 percent) durability and is built for very high availability.
| Concept | Details |
| Bucket | A container with a globally unique name, created in one Region. Data stays in that Region unless you replicate it |
| Object | A file plus metadata. Identified by key (full path name like reports/2026/jan.csv). Max size 5 TB; single upload via PUT up to 5 GB, use multipart above 100 MB |
| Prefix | Folders are only a naming convention. S3 is flat |
| Consistency | Strong read-after-write consistency for all operations |
| Limits | Unlimited objects. 100 buckets per account by default (can be increased) |
bash
aws s3 mb s3://acme-data-prod-ap-south-1 --region ap-south-1
aws s3 cp report.csv s3://acme-data-prod-ap-south-1/reports/2026/report.csv
aws s3 sync ./site s3://acme-site --delete
aws s3 ls s3://acme-data-prod-ap-south-1/reports/ --recursive --human-readable --summarize
aws s3 presign s3://acme-data-prod-ap-south-1/reports/2026/report.csv --expires-in 900
aws s3api put-bucket-versioning --bucket acme-data-prod-ap-south-1 --versioning-configuration Status=Enabled
Storage Classes
| Class | Use for | Retrieval | Min storage | AZs |
| S3 Standard | Frequently accessed data, websites, analytics | Immediate | None | 3+ |
| S3 Intelligent-Tiering | Unknown or changing access patterns: moves objects between tiers automatically | Immediate (plus optional archive tiers) | None (small monitoring fee per object) | 3+ |
| S3 Standard-IA (Infrequent Access) | Long-lived data accessed rarely but needed fast (backups) | Immediate, retrieval fee | 30 days, 128 KB | 3+ |
| S3 One Zone-IA | Re-creatable infrequent data (secondary copies) | Immediate, retrieval fee | 30 days, 128 KB | 1 (lost if the AZ is lost) |
| S3 Express One Zone | Single-digit millisecond latency for the most latency-sensitive apps, ML training | Immediate | None | 1 (directory bucket) |
| S3 Glacier Instant Retrieval | Archive accessed about once per quarter, needs milliseconds | Milliseconds | 90 days | 3+ |
| S3 Glacier Flexible Retrieval | Archive, retrieval in minutes to hours | Expedited 1-5 min, Standard 3-5 h, Bulk 5-12 h | 90 days | 3+ |
| S3 Glacier Deep Archive | Cheapest, long-term retention (7-10+ years), rare access | Standard 12 h, Bulk 48 h | 180 days | 3+ |
Memory trick: Hotter = more expensive to store, cheaper to read. Colder = cheaper to store, retrieval fee and delay. Unknown pattern → Intelligent-Tiering.
Versioning
- Keeps every version of an object. Delete adds a delete marker, the old versions stay and can be restored
- Protects against accidental delete and overwrite
- Once enabled it can only be suspended, not removed
- MFA Delete requires MFA to permanently delete versions or change versioning (set by the root user)
- Old versions cost money: use lifecycle rules to expire them
Lifecycle Rules
json
{
"Rules": [{
"ID": "tier-and-expire",
"Status": "Enabled",
"Filter": {"Prefix": "logs/"},
"Transitions": [
{"Days": 30, "StorageClass": "STANDARD_IA"},
{"Days": 90, "StorageClass": "GLACIER"},
{"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
],
"Expiration": {"Days": 2555},
"NoncurrentVersionExpiration": {"NoncurrentDays": 60},
"AbortIncompleteMultipartUpload": {"DaysAfterInitiation": 7}
}]
}
bash
aws s3api put-bucket-lifecycle-configuration --bucket acme-logs --lifecycle-configuration file://lifecycle.jso
- Transitions move to colder classes. Only in one direction (Standard → IA → Glacier ...)
- Expiration deletes objects (and noncurrent versions)
- Always add **
AbortIncompleteMultipartUpload** to avoid paying for unfinished uploads
Replication
| Type | Use |
| CRR (Cross-Region Replication) | Disaster recovery, lower latency for far users, compliance copies in another Region |
| SRR (Same-Region Replication) | Aggregate logs, copy between prod and test accounts, keep a replica for sovereignty |
- Versioning must be enabled on source and destination buckets
- Needs an IAM role for S3 to replicate
- Replicates new objects after the rule is created. Use S3 Batch Replication for existing objects
- Delete markers are not replicated by default
- Replication Time Control (RTC) gives a 15-minute SLA for 99.99 percent of objects
- Can replicate to a different storage class and different account
Security
| Control | What it does |
| Block Public Access | Account and bucket switches that override ACLs and policies that would make data public. Keep all four ON unless you truly host public content (and even then prefer CloudFront with OAC) |
| Bucket policy | Resource-based JSON policy: cross-account access, require HTTPS, require encryption, limit to a VPC endpoint or IP |
| IAM policies | Identity-based permissions for users and roles |
| ACLs | Legacy. Disable them with Bucket owner enforced (Object Ownership) |
| S3 Access Points | Named endpoints with their own policy for different applications or teams |
| Encryption | SSE-S3 by default; SSE-KMS for audit and control |
| Access logging and CloudTrail data events | Record who accessed objects |
| Macie | Finds sensitive data (PII) in buckets |
json
{
"Version": "2012-10-17",
"Statement": [
{"Sid": "DenyInsecureTransport", "Effect": "Deny", "Principal": "*", "Action": "s3:*",
"Resource": ["arn:aws:s3:::acme-data-prod-ap-south-1", "arn:aws:s3:::acme-data-prod-ap-south-1/*"],
"Condition": {"Bool": {"aws:SecureTransport": "false"}}},
{"Sid": "AllowOnlyFromOurVpcEndpoint", "Effect": "Deny", "Principal": "*", "Action": "s3:*",
"Resource": ["arn:aws:s3:::acme-data-prod-ap-south-1", "arn:aws:s3:::acme-data-prod-ap-south-1/*"],
"Condition": {"StringNotEquals": {"aws:SourceVpce": "vpce-0abc1234"}}}
]
}
bash
aws s3api put-public-access-block --bucket acme-data-prod-ap-south-1 --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
aws s3api put-bucket-ownership-controls --bucket acme-data-prod-ap-south-1 --ownership-controls 'Rules=[{ObjectOwnership=BucketOwnerEnforced}]'
Presigned URLs
A presigned URL gives temporary access to one object without making the bucket public. It is signed with the credentials of the creator and expires (up to 7 days with long-term keys, shorter with temporary credentials).
python
import boto3
s3 = boto3.client("s3")
url = s3.generate_presigned_url("get_object", Params={"Bucket": "acme-data-prod-ap-south-1", "Key": "reports/2026/report.csv"}, ExpiresIn=900)
upload = s3.generate_presigned_post("acme-uploads", "user-42/${filename}", ExpiresIn=600) # let browsers upload directly
Events, Hosting and Object Lock
- Event notifications to Lambda, SQS, SNS or EventBridge on object created or removed. EventBridge adds filtering and many targets
- Static website hosting: HTTP only from the S3 website endpoint. For HTTPS, custom domains and global speed put CloudFront in front with Origin Access Control (OAC) and keep the bucket private
- Object Lock (WORM: write once read many): Governance mode (privileged users can override) and Compliance mode (nobody, not even root, until retention ends), plus legal hold. Requires versioning
- S3 Inventory (daily or weekly list of objects), S3 Storage Lens (usage and activity dashboard), S3 Batch Operations (run actions on billions of objects)
- S3 Select / Athena query data in place
Performance
- S3 scales to at least 3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD requests per second per prefix. More prefixes mean more throughput
- Multipart upload for big files (parallel parts, retry a failed part). Recommended above 100 MB, required above 5 GB
- S3 Transfer Acceleration uses CloudFront edge locations for fast uploads over long distances (
bucket.s3-accelerate.amazonaws.com)
- Byte-range fetches to download parts in parallel or read headers
- Use CloudFront to cache popular objects close to users
- Compress and use bigger objects or columnar formats (Parquet) for analytics
Pricing Components
| You pay for | Notes |
| Storage per GB-month | By storage class |
| Requests | PUT, GET, LIST, lifecycle transitions |
| Data transfer out to the internet and between Regions | Data in is free. Transfer to CloudFront and within the same Region to EC2 is free |
| Retrieval fees and minimum charges | For IA and Glacier classes |
| Management features | Inventory, Storage Lens advanced, replication RTC, KMS requests |
Requester pays: A bucket can be set so the requester pays the request and transfer cost, useful for sharing big public datasets.
Common Design Patterns
| Need | Pattern |
| Private files for users in an app | Private bucket, app creates presigned URLs |
| Static website | S3 + CloudFront (OAC) + ACM certificate + Route 53 |
| Data lake | S3 + Glue Data Catalog + Athena + Lake Formation |
| Backups with long retention | Lifecycle to Glacier / Deep Archive, Object Lock |
| Disaster recovery | Versioning + CRR to another Region |
| Big file upload from browsers/mobile | Presigned multipart or Transfer Acceleration |
Practice Tasks
- Create a bucket, enable versioning, upload a file twice and list versions, then delete and restore
- Add a lifecycle rule that moves
logs/ to Standard-IA after 30 days and expires after one year
- Set up CRR to a bucket in another Region and test with a new object
- Write a bucket policy that denies non-HTTPS requests
- Host a static site with S3 and CloudFront using OAC and a private bucket
Conclusion
S3 is durable, scalable object storage. Choose a storage class by access pattern, use versioning, lifecycle and replication for protection and cost, keep Block Public Access on, control access with policies and presigned URLs, and put CloudFront in front for websites and global performance.
Quick Summary: buckets/objects; storage class table; versioning/MFA delete; lifecycle JSON; CRR vs SRR; security controls + policy examples; presigned; Object Lock; performance; pricing; patterns.