S3 Operations and Data Management
Overview
Amazon S3 is object storage with effectively unlimited capacity. Day-to-day operations revolve around protecting data (versioning, replication, Object Lock), optimising cost (storage classes, lifecycle policies), securing access (Block Public Access, bucket policies) and observing usage (Storage Lens, inventory, metrics).
Think of S3 as a warehouse with automatic shelving. You decide which shelf class suits each box (hot, cool, deep freeze), set rules that move boxes over time, install security cameras (logging), and keep carbon copies (replication) in another warehouse.
SysOps scenarios commonly involve accidental deletion, cost drift, cross-account access and 403 errors.
Key Concepts
- Storage classes: Standard, Intelligent-Tiering, Standard-IA, One Zone-IA, Glacier Instant Retrieval, Glacier Flexible Retrieval, Glacier Deep Archive, plus S3 Express One Zone.
- Versioning protects against overwrite/delete (delete adds a delete marker); MFA Delete adds protection for permanent deletes; once enabled, versioning can only be suspended.
- Lifecycle rules transition objects between classes and expire current/non-current versions, incomplete multipart uploads and delete markers.
- Replication (CRR/SRR) needs versioning on both buckets, an IAM role, and replicates new objects only (use Batch Replication for existing); replicate delete markers optionally.
- Object Lock (governance / compliance mode, legal hold) gives WORM retention and requires versioning.
- Block Public Access, bucket policies, ACL disabling (Bucket owner enforced) and Access Points manage security at scale.
- Monitoring: CloudWatch request/storage metrics, Storage Lens dashboards, S3 Inventory, server access logs (best effort) and CloudTrail data events (precise).
- Event notifications to SNS/SQS/Lambda/EventBridge; Batch Operations run actions across billions of objects; request rates scale to 3,500 PUT / 5,500 GET per second per prefix.
Detailed Notes
Storage class choice
| Class | Access pattern | Min duration | Retrieval |
|---|---|---|---|
| Standard | Frequent | none | ms |
| Intelligent-Tiering | Unknown/changing | none (30-day monitoring) | ms (archive tiers optional) |
| Standard-IA | Infrequent, multi-AZ | 30 days | ms, per-GB fee |
| One Zone-IA | Re-creatable, infrequent | 30 days | ms |
| Glacier Instant | Archive, instant | 90 days | ms |
| Glacier Flexible | Archive | 90 days | minutes-12 h |
| Deep Archive | Long-term | 180 days | 12-48 h |
Lifecycle policy
{
"Rules": [{
"ID": "logs-tiering",
"Status": "Enabled",
"Filter": { "Prefix": "logs/" },
"Transitions": [
{ "Days": 30, "StorageClass": "STANDARD_IA" },
{ "Days": 90, "StorageClass": "GLACIER" }
],
"Expiration": { "Days": 730 },
"NoncurrentVersionExpiration": { "NoncurrentDays": 30 },
"AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
}]
}
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket --lifecycle-configuration file://lc.json
aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled
aws s3api list-object-versions --bucket my-bucket --prefix report.csv
Recovering a deleted object
With versioning, a normal DELETE adds a delete marker. Remove the marker (delete that specific version ID) to restore the object:
aws s3api delete-object --bucket my-bucket --key report.csv --version-id <DELETE_MARKER_VERSION_ID>
Replication
aws s3api put-bucket-replication --bucket src-bucket --replication-configuration '{
"Role":"arn:aws:iam::111122223333:role/s3-replication",
"Rules":[{"ID":"all","Status":"Enabled","Priority":1,"Filter":{},
"DeleteMarkerReplication":{"Status":"Enabled"},
"Destination":{"Bucket":"arn:aws:s3:::dest-bucket","StorageClass":"STANDARD_IA"}}]}'
Use Replication Time Control (RTC) for 15-minute SLA. Objects encrypted with SSE-KMS need KMS permissions on source and destination keys.
Securing buckets
aws s3api put-public-access-block --bucket my-bucket --public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
Enforce TLS and encryption with a bucket policy condition aws:SecureTransport = false -> Deny. SSE-S3 is applied to all new objects by default.
Troubleshooting S3
| Symptom | Cause |
|---|---|
| 403 AccessDenied | IAM/bucket policy, Block Public Access, KMS key access, object owned by another account, VPC endpoint policy |
| 404 on existing key | Wrong Region/prefix, key case sensitivity, eventual propagation of delete marker |
| 503 Slow Down | Request rate to a prefix too high -> spread prefixes, retry with exponential backoff |
| Replication not happening | Versioning disabled, role permissions, object existed before rule, SSE-KMS permissions |
| Unexpected costs | Old versions, incomplete multipart uploads, request/transfer charges, Intelligent-Tiering monitoring fees on tiny objects |
| Slow large uploads | Use multipart upload, Transfer Acceleration, parallel threads |
Insight tools
| Tool | Value |
|---|---|
| Storage Lens | Organisation-wide usage and activity dashboards, recommendations |
| S3 Inventory | Scheduled object list (CSV/Parquet) with encryption/replication status |
| Storage class analysis | Recommends IA transition thresholds |
| CloudTrail data events | Who accessed which object |
| Feature | Operational notes |
|---|---|
| Lifecycle rules | Transition between classes and expire objects/noncurrent versions; minimum storage durations apply (for example 30 days for Standard-IA) |
| Intelligent-Tiering | Auto-moves objects by access pattern; small monitoring fee per object |
| CRR / SRR | Needs versioning on both buckets; replicates new objects only (use Batch Replication for existing); delete markers optional |
| S3 Object Lock | WORM retention, governance or compliance mode |
| Event notifications | To SNS, SQS, Lambda or EventBridge |
| S3 Inventory / Storage Lens | Visibility and cost analytics |
| Multipart upload | Abort incomplete uploads with a lifecycle rule |
aws s3api put-bucket-lifecycle-configuration --bucket logs-prod --lifecycle-configuration file://lifecycle.json
aws s3api get-bucket-replication --bucket logs-prod
aws s3api put-public-access-block --bucket logs-prod --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
For AccessDenied check in order: IAM policy, bucket policy, Block Public Access, SCP, VPC endpoint policy, KMS key permissions for SSE-KMS objects, and object ownership (disable ACLs with bucket owner enforced). 503 SlowDown means high request rates on a prefix: spread keys and add retries with backoff. Pre-signed URLs expire with the signer's credentials, so role-based URLs end when the session does.
Real World Example
Scenario – accidental deletion and creeping cost. An analyst's script deleted a prefix of customer reports. Because the bucket had versioning, the ops team listed versions and removed the delete markers to restore everything in minutes. They then enabled MFA Delete for the compliance bucket and a replication rule to a second Region.
Storage Lens revealed 40 TB of non-current versions and incomplete multipart uploads. A lifecycle rule now expires non-current versions after 30 days and aborts incomplete uploads after 7, cutting the bill by 30%.
Architecture Diagram
- 1Applications write objects; versioning keeps every version.
- 2Replication copies new objects to a bucket in another Region.
- 3Lifecycle rules transition older objects to cheaper classes and eventually expire them.
- 4Storage Lens and inventory report usage so rules can be tuned.
Best Practices
- ✓Enable versioning (plus MFA Delete or Object Lock where required) and Block Public Access account-wide.
- ✓Add lifecycle rules for non-current versions, delete markers and incomplete multipart uploads.
- ✓Use Intelligent-Tiering when access patterns are unknown.
- ✓Replicate critical data cross-Region and monitor replication metrics.
- ✓Enable Storage Lens, inventory and CloudTrail data events for sensitive buckets.
Common Interview Questions
Exam Tips
SOA-C03 focus
- Protect against accidental deletion -> versioning (+ MFA Delete); WORM compliance -> Object Lock.
- Move data between classes automatically -> lifecycle; unknown access -> Intelligent-Tiering.
- Replication requires versioning in both buckets and affects only new objects.
- Accessing S3 privately from a VPC -> gateway endpoint; auditing object access -> CloudTrail data events.
Finished this lesson?
0 of 46 lessons done · 0% of the course

