Amazon S3 Operations: Versioning, Lifecycle, Replication, Encryption, Access Control, Events and Troubleshooting
Storage Classes
| Class | Use | Notes |
| Standard | Frequent access | Default, 11 nines durability, 3+ AZs |
| Intelligent-Tiering | Unknown or changing access | Auto-moves between tiers, small monitoring fee, no retrieval fee |
| Standard-IA | Infrequent, needs fast access | Min 30 days, 128 KB min billable size, retrieval fee |
| One Zone-IA | Re-creatable infrequent data | Single AZ, cheaper |
| Glacier Instant Retrieval | Rare access, millisecond retrieval | Min 90 days |
| Glacier Flexible Retrieval | Archive, minutes to hours | Min 90 days. Expedited, Standard, Bulk |
| Glacier Deep Archive | Long-term archive (compliance) | Min 180 days, restore in about 12 to 48 hours |
| Express One Zone | Single-digit ms, high request rates | Directory buckets, single AZ |
Versioning and MFA Delete
- Versioning keeps every version. A delete adds a delete marker. Remove the marker to restore. Once enabled it can only be suspended, never fully disabled
- Protects against accidental overwrite and delete. Costs storage for old versions, so pair with a lifecycle rule for noncurrent versions
- MFA Delete requires MFA to permanently delete versions or change versioning (root user only, CLI)
bash
aws s3api put-bucket-versioning --bucket ops-data --versioning-configuration Status=Enabled
aws s3api list-object-versions --bucket ops-data --prefix report.csv
aws s3api delete-object --bucket ops-data --key report.csv --version-id <delete-marker-id> # undelete
Lifecycle Rules
json
{"Rules": [{"ID": "logs-tiering", "Status": "Enabled", "Filter": {"Prefix": "logs/"},
"Transitions": [{"Days": 30, "StorageClass": "STANDARD_IA"}, {"Days": 90, "StorageClass": "GLACIER"}],
"Expiration": {"Days": 365},
"NoncurrentVersionExpiration": {"NoncurrentDays": 30},
"AbortIncompleteMultipartUpload": {"DaysAfterInitiation": 7}}]}
- Actions: transition, expiration, noncurrent version transition/expiration, abort incomplete multipart uploads, remove expired delete markers
- Always add AbortIncompleteMultipartUpload because hidden parts cost money
- Transitions have minimum days and size rules, and small objects may cost more in IA classes
Replication
| Type | Use |
| CRR (cross-Region) | Disaster recovery, lower latency, compliance |
| SRR (same-Region) | Log aggregation, prod/test copies, different owner accounts |
- Needs versioning on source and destination and an IAM role for S3
- Replicates new objects only. Use S3 Batch Replication for existing objects and failed ones
- Delete markers replication is optional. Version deletes are not replicated
- Replication Time Control (RTC): 15-minute SLA with metrics. Monitor
ReplicationLatency and OperationsFailedReplication
- KMS-encrypted objects need extra settings and key permissions
Encryption
| Mode | Key owner | Notes |
| SSE-S3 | S3 | Default for all new objects (AES-256), free |
| SSE-KMS | KMS key | Audit in CloudTrail, key policy control. KMS request quotas can throttle very high request rates. Use S3 Bucket Keys to cut KMS calls and cost |
| DSSE-KMS | KMS | Dual-layer encryption |
| SSE-C | Customer | You supply the key on every request (HTTPS only) |
| Client-side | You | Encrypt before upload |
- Enforce TLS with a bucket policy condition
aws:SecureTransport = false → deny
- Bucket policy can require a specific encryption header or key
Access Control
| Tool | Notes |
| Block Public Access | Four settings at account and bucket level. Keep on unless a public site is truly intended |
| Bucket policy | Resource policy: cross-account access, conditions (IP, VPC endpoint aws:SourceVpce, TLS, org id) |
| IAM policy | Identity-based permissions |
| ACLs | Legacy. Set Object Ownership = Bucket owner enforced to disable ACLs |
| Access Points | Named endpoints with their own policy per application or team, can be VPC-restricted |
| Pre-signed URLs | Temporary access using the creator's permissions. Expiry limited by credentials' lifetime |
| Access Analyzer for S3 | Finds buckets shared outside the account or org |
Data Protection Extras
- Object Lock (WORM): Governance (privileged users can override) or Compliance (nobody can delete until retention ends), plus legal hold. Requires versioning
- Glacier Vault Lock for vault policies in Glacier
- S3 Object Lambda / Access Grants for dynamic access patterns
Events and Notifications
- Send events (
s3:ObjectCreated:*, ObjectRemoved, Replication, LifecycleExpiration) to SNS, SQS, Lambda or EventBridge (richer filtering, many targets)
- Test with a prefix filter. Beware recursion: a Lambda that writes into the same bucket prefix triggers itself
Visibility: Inventory, Storage Lens, Metrics, Logs
| Feature | Gives you |
| S3 Inventory | Daily or weekly CSV/Parquet list of objects and metadata for Athena queries |
| Storage Lens | Org-wide usage and activity dashboards, cost optimization recommendations |
| CloudWatch request metrics | 4xxErrors, 5xxErrors, FirstByteLatency per prefix (opt-in, charged) |
| Server access logs | Best-effort request log to another bucket |
| CloudTrail data events | Object-level API audit (costs more), reliable |
Performance
- Each prefix supports at least 3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD requests per second, and you can use many prefixes in parallel
- Multipart upload for objects over 100 MB (required above 5 GB, max object 5 TB). Parallel byte-range GETs for downloads
- Transfer Acceleration speeds long-distance uploads using edge locations
- CloudFront for repeated reads. S3 Express One Zone for lowest latency
Troubleshooting 403 Access Denied
- Is the principal allowed by IAM and the bucket policy (cross-account needs both sides)?
- Any explicit Deny (policy, SCP, permission boundary, VPC endpoint policy)?
- Block Public Access or ownership settings blocking it?
- SSE-KMS: does the principal have
kms:Decrypt/GenerateDataKey on the key?
- Bucket policy conditions: wrong IP, VPC endpoint, TLS, org id?
- Object owned by another account (ACL era)? Use bucket owner enforced.
- Wrong key name or Region, or an Access Point policy
| Error | Meaning |
NoSuchKey vs AccessDenied | Without s3:ListBucket, a missing object returns 403 instead of 404 |
SlowDown (503) | Too many requests on a prefix: spread keys, add retries with backoff |
RequestTimeTooSkewed | Clock mismatch on the client |
BucketAlreadyExists | Bucket names are global |
Static Website Hosting
A bucket can serve a static site. Best practice: keep the bucket private, put CloudFront with Origin Access Control (OAC) in front, attach an ACM certificate and a WAF if needed, and do not make the bucket public.
Practice Tasks
- Enable versioning, delete an object and restore it
- Create a lifecycle rule for logs with transition, expiration and multipart cleanup
- Set up CRR to another Region and test with RTC metrics
- Write a bucket policy denying non-TLS requests and requiring KMS
- Run Access Analyzer and fix one external-access finding
Conclusion
Operate S3 by choosing storage classes and lifecycle rules, protecting data with versioning, replication and Object Lock, encrypting with SSE-S3 or SSE-KMS (use Bucket Keys), controlling access with Block Public Access and policies, watching with Inventory, Storage Lens and metrics, and debugging 403s step by step.
Quick Summary: storage classes; versioning; lifecycle; replication; encryption; access; Object Lock; events; visibility; performance; 403 troubleshooting.