S3: Consistency, Classes, Lifecycle
AWS for Interviews: lesson 2 of 18
Strong reads, a class per access pattern, and rules that age data out.
Lesson 2 of 18 · 6 min
S3: Consistency, Classes, Lifecycle
Step 1 of 10
A bucket is a flat namespace of keys. Every object also has a storage class; Standard is the default.
The Idea
S3 stores objects under keys in a bucket, and reads are strongly consistent: after a successful PUT or DELETE, the next GET or LIST sees it. Every object has a storage class — Standard for hot data, Standard-IA and Glacier Instant Retrieval for rare reads, and archive classes (Glacier Flexible Retrieval, Deep Archive) that must be restored before reading.
Real-World Example
A photo app's originals are opened constantly for a week and almost never after six months. One lifecycle rule moves them to Standard-IA at 30 days, to Glacier Flexible Retrieval at 180, and expires them at a year — no cleanup job to maintain.
The Tradeoff
Colder classes charge per-GB retrieval fees and bill minimum storage durations, so moving short-lived or tiny objects can cost more than leaving them. When access is unpredictable, S3 Intelligent-Tiering moves objects between tiers for you, with no retrieval fees.
Hands-On
# illustrative — needs an AWS account; bucket name is a placeholder
aws s3api put-bucket-lifecycle-configuration --bucket photos-bucket \
--lifecycle-configuration file://lifecycle.json
# lifecycle.json
# {"Rules": [{"ID": "age-out", "Status": "Enabled", "Filter": {"Prefix": "raw/"},
# "Transitions": [{"Days": 30, "StorageClass": "STANDARD_IA"},
# {"Days": 180, "StorageClass": "GLACIER"}],
# "Expiration": {"Days": 365}}]}
Your turn
Put the steps in the right order.
- The expiration action deletes the object
- The object is uploaded to S3 Standard
- It moves to Glacier Flexible Retrieval; a read now needs a restore
- It moves to Standard-IA once reads become rare
Mini quiz
1 / 3
You overwrite an object and immediately GET it. What does S3 return?
Sources
- What is Amazon S3? (consistency model) — Amazon S3 User Guide
- Understanding and managing S3 storage classes — Amazon S3 User Guide
- Managing the lifecycle of objects — Amazon S3 User Guide
- put-bucket-lifecycle-configuration — AWS CLI Reference