Skip to content
Visual explainer 5h to learn 5 steps

S3 storage classes, lifecycle, versioning & replication

Design a cost-effective, durable S3 strategy for a given access pattern.

By Invicly Tech, , in AWS Solutions Architect – Associate. About 13 minutes to read.

Topic 17 of 34

In short

S3 stores objects in buckets with eleven nines of durability. Storage classes trade retrieval speed and fees for lower storage price, and lifecycle rules move or expire objects automatically. Versioning protects against deletes and is required for replication.

Explained simply

Amazon S3 (Simple Storage Service) stores files, which AWS calls objects, inside containers called buckets. Each object has a key (its full name, like photos/2026/cat.jpg), the data itself, and some metadata. There are no real folders: the slashes are just part of the key, and the console draws folders to help you.

S3 is built to keep data safe. Most storage classes keep copies in several Availability Zones (separate data centers), and S3 is designed for 99.999999999 percent durability, often called eleven nines. If you store 10 million objects, you would expect to lose one about once every 10,000 years.

Not all data is read equally. New uploads are read often, old logs almost never. S3 offers storage classes: the cheaper ones charge less per GB to store, but add a fee per GB to read, a minimum storage time, or a wait before you can read. Lifecycle rules move objects between classes automatically as they get older.

Two features protect you from mistakes. Versioning keeps every old version of an object, so an overwrite or a delete can be undone. Replication copies objects to another bucket, in the same Region or a different one, for backup, compliance, or lower latency for users far away.

Press Play on a diagram to walk through it one step at a time.

CompareS3 storage classes
Frequent access
  • Standard: default, multi-AZ
  • Intelligent-Tiering: unknown patterns
  • Express One Zone: lowest latency
Infrequent access
  • Standard-IA: 30-day minimum
  • One Zone-IA: one AZ, recreatable data
  • Retrieval fee per GB
Archive
  • Glacier Instant: milliseconds, 90 days
  • Glacier Flexible: minutes to hours
  • Deep Archive: 12 to 48 hours
  • Deep Archive is cheapest
FlowA typical lifecycle rule
  1. 1
    Day 0: Standard

    New uploads are read often.

  2. 2
    Day 30: Standard-IA

    Reads drop but must stay instant.

  3. 3
    Day 90: Glacier Flexible

    Kept for audits, hours to restore.

  4. 4
    Day 365: Deep Archive

    Long-term compliance retention.

  5. 5
    Year 7: Expire

    Delete when retention ends.

MapPick a storage class by how data is read
How is the data read?
  • Often, or pattern unknown
    • S3 Standard
    • Intelligent-Tiering if it changes over time
  • About monthly, must be instant
    • Standard-IA
    • One Zone-IA if you can recreate it
  • Quarterly or less, must be instant
    • Glacier Instant Retrieval
  • Rarely, can wait hours
    • Glacier Flexible Retrieval
    • Deep Archive if 12 to 48 hours is fine
  • Very hot, next to compute
    • S3 Express One Zone
    • Single-digit millisecond reads in one AZ
SequenceCross-Region Replication with a delete
App
Source bucket
Destination bucket
  1. 1PUT report.csv
    App to Source bucket: PUT report.csv
  2. 2200 OK, version v1
    Source bucket to App: 200 OK, version v1
  3. 3Async copy using the IAM role
    Source bucket to Destination bucket: Async copy using the IAM role
  4. 4Stored with status REPLICA
    Destination bucket to Destination bucket: Stored with status REPLICA
  5. 5DELETE report.csv (no version ID)
    App to Source bucket: DELETE report.csv (no version ID)
  6. 6Delete marker copied only if enabled
    Source bucket to Destination bucket: Delete marker copied only if enabled

In depth

Choosing a class: the hidden charges

The price per GB is only part of the bill. Standard-IA and One Zone-IA charge for at least 30 days of storage and at least 128 KB per object, plus a retrieval fee per GB read. Glacier Instant Retrieval and Glacier Flexible Retrieval have a 90-day minimum, and Deep Archive has 180 days. If you delete or move an object early, you still pay for the remaining days.

So the IA classes suit objects that are fairly large, kept for months, and read rarely. Millions of tiny files that live for a week are cheaper in Standard. Intelligent-Tiering has no retrieval fees. Instead it charges a small monthly monitoring fee per object and moves objects to cheaper tiers after 30 and 90 days without access. Objects under 128 KB are never moved and pay no monitoring fee, so they always stay in the frequent tier.

  • Standard-IA and One Zone-IA: 30-day minimum, 128 KB minimum billable size
  • Glacier Instant and Glacier Flexible: 90-day minimum
  • Deep Archive: 180-day minimum
  • Intelligent-Tiering: no retrieval fee, small per-object monitoring fee

Getting data back from the Glacier classes

Glacier Instant Retrieval returns data in milliseconds, like Standard-IA, but each read costs more. The other two archive classes need a restore first. You call RestoreObject (aws s3api restore-object) with a number of days and a speed. S3 then creates a temporary readable copy, and you read that copy until the days run out. The archived object itself stays where it is.

Glacier Flexible Retrieval offers three speeds: Expedited in 1 to 5 minutes, Standard in 3 to 5 hours, and Bulk in 5 to 12 hours, which is free. Deep Archive offers Standard within 12 hours and Bulk within 48 hours. Exam questions often hide the answer in how long the business can wait.

SequenceRestoring an object from Glacier Flexible Retrieval
Your app
Amazon S3
  1. 1restore-object: Days 7, Tier Standard
    Your app to Amazon S3: restore-object: Days 7, Tier Standard
  2. 2202 Accepted, restore in progress
    Amazon S3 to Your app: 202 Accepted, restore in progress
  3. 3HEAD object: still restoring?
    Your app to Amazon S3: HEAD object: still restoring?
  4. 43 to 5 hours later: temporary copy ready
    Amazon S3 to Amazon S3: 3 to 5 hours later: temporary copy ready
  5. 5GET object reads the temporary copy
    Your app to Amazon S3: GET object reads the temporary copy
  6. 6After 7 days the temporary copy is removed
    Amazon S3 to Amazon S3: After 7 days the temporary copy is removed

Versioning and delete markers

Once versioning is on, every upload of the same key creates a new version with its own version ID. A plain DELETE does not remove any data: S3 puts a delete marker on top, and the object looks gone. Remove that marker, or GET an older version ID, and the data is back. Only a DELETE that names a specific version ID removes that version for good.

A bucket can be unversioned, enabled or suspended, but it can never go back to unversioned. Old versions are billed like any other data, so add a lifecycle rule with NoncurrentVersionExpiration, for example to keep old versions for 30 days. MFA delete adds a second check: deleting a version or changing the versioning state needs a code from an MFA device. Only the root user can turn it on, and only with the CLI or API, not the console.

FlowOne key in a versioned bucket
  1. 1
    PUT report.csv

    Version v1 is current

  2. 2
    PUT report.csv again

    v2 is current, v1 is kept

  3. 3
    DELETE report.csv

    A delete marker becomes current

  4. 4
    GET report.csv

    Returns 404, but v1 and v2 still exist

  5. 5
    Delete the marker

    v2 is current again

How replication really behaves

Replication needs versioning on both buckets and an IAM role that S3 uses to copy objects. Rules can filter by prefix or tag, choose a cheaper storage class at the destination, and hand ownership to the destination account. Same-Region Replication (SRR) suits log collection or a separate test copy. Cross-Region Replication (CRR) suits disaster recovery, compliance and users in another Region.

Some things are not copied by default. Objects that existed before the rule need S3 Batch Replication. Delete markers are copied only if you turn on delete marker replication, and deleting a specific version is never replicated, which protects the copy from a malicious delete. Replication is asynchronous and most objects arrive within minutes. S3 Replication Time Control (RTC) adds an SLA: 99.99 percent of new objects replicate within 15 minutes.

  • Needs versioning on source and destination
  • Existing objects: use S3 Batch Replication
  • Replicas are not replicated again by default (no chaining)
  • SSE-KMS objects need the KMS key settings in the rule

Performance at scale

S3 scales per prefix (the part of the key before the object name, such as logs/2026/). Each prefix supports at least 3,500 PUT, COPY, POST or DELETE requests and 5,500 GET or HEAD requests per second, and there is no limit on the number of prefixes. Spread keys over 10 prefixes and you get roughly 10 times the request rate.

For big files, multipart upload splits an object into parts of 5 MiB to 5 GiB (up to 10,000 parts) that upload in parallel and retry on their own. One single PUT can be at most 5 GB, so larger objects must use multipart; the AWS CLI does this automatically. Byte-range GETs do the same for downloads. Transfer Acceleration sends uploads through CloudFront edge locations, which helps users far from the bucket. Since 2020 S3 is strongly consistent: a read after a successful write always sees the new data.

Learn it in 5 short steps

About 1h each. Track them with a timer in your plan.

  1. 1
    Compare S3 storage classes~1h
  2. 2
    Write lifecycle rules to tier and expire data~1h
  3. 3
    Enable versioning and MFA delete~1h
  4. 4
    Set up cross-Region replication~1h
  5. 5
    Design storage for a given access pattern~1h

Key points

  • Use Intelligent-Tiering when access patterns are unknown or change.
  • Same-Region and cross-Region replication both require versioning on source and destination.
  • MFA delete and Object Lock protect against accidental or malicious deletion.
  • Replication copies new objects; use Batch Replication for existing ones.
  • Use multipart upload for large objects, recommended above 100 MB.

Key terms

Tap a card to flip it. 0/5 known

Examples

json
{"Rules": [{
  "ID": "tier-logs",
  "Filter": {"Prefix": "logs/"},
  "Status": "Enabled",
  "Transitions": [
    {"Days": 30, "StorageClass": "STANDARD_IA"},
    {"Days": 90, "StorageClass": "GLACIER"}
  ],
  "Expiration": {"Days": 2555}
}]}

Lifecycle config for aws s3api put-bucket-lifecycle-configuration.

Undo an accidental delete

A teammate deleted reports/q3.csv from a versioned bucket. Nothing is lost yet: S3 only added a delete marker. Step 1: list the versions and delete markers for that key. Step 2: find the delete marker that is marked IsLatest and copy its VersionId. Step 3: delete the marker itself by naming its version ID. The newest real version becomes current again, with no copy or restore needed.

bash
# 1. See all versions and delete markers for the key
aws s3api list-object-versions --bucket my-bucket --prefix reports/q3.csv \
  --query '{versions: Versions[].[VersionId,IsLatest], markers: DeleteMarkers[].[VersionId,IsLatest]}'

# 2. Remove the delete marker (use the marker's VersionId)
aws s3api delete-object --bucket my-bucket --key reports/q3.csv \
  --version-id MARKER_VERSION_ID

# 3. The previous version is current again
aws s3api head-object --bucket my-bucket --key reports/q3.csv

Storage design for a photo app

Users view new photos a lot in the first month, rarely afterwards, but any photo must open instantly. Thumbnails are small (about 30 KB) and can be regenerated. Step 1: keep originals in Standard for 30 days, then move them to Standard-IA, then to Glacier Instant Retrieval at 90 days, which still reads in milliseconds. Step 2: leave thumbnails in Standard, because IA would bill each one as 128 KB. Step 3: enable versioning, and expire old versions after 30 days so overwrites don't pile up cost.

json
{"Rules": [{
  "ID": "originals-tiering",
  "Filter": {"Prefix": "originals/"},
  "Status": "Enabled",
  "Transitions": [
    {"Days": 30, "StorageClass": "STANDARD_IA"},
    {"Days": 90, "StorageClass": "GLACIER_IR"}
  ],
  "NoncurrentVersionExpiration": {"NoncurrentDays": 30}
}]}

Quick reference

  • aws s3api put-bucket-versioning --bucket b --versioning-configuration Status=Enabled
  • Minimum storage days: IA classes 30, Glacier Instant and Flexible 90, Deep Archive 180
  • IA and Glacier Instant bill at least 128 KB per object; keep tiny files in Standard
  • Glacier Flexible restore: Expedited 1-5 min, Standard 3-5 h, Bulk 5-12 h (free)
  • Deep Archive restore: Standard within 12 h, Bulk within 48 h
  • Per prefix: 3,500 writes and 5,500 reads per second; add prefixes to scale
  • Single PUT max 5 GB; use multipart upload for large files (the CLI does it for you)
  • Replication skips objects that existed before the rule; use S3 Batch Replication

Common mistakes

  • Moving tiny or short-lived objects to IA classes and paying minimum size and duration charges.
  • Choosing One Zone-IA for data that cannot be recreated.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1A team stores 2 million log files of 20 KB each for 7 days, then deletes them. Which class is cheapest?

Question 2

2Versioning is enabled and a user runs aws s3 rm on a file. What happens?

Question 3

3Data in Glacier Flexible Retrieval is needed within 10 minutes for an urgent audit. Which retrieval option?

Question 4

4After setting up CRR, the destination only has files uploaded after the rule was created. How do you copy the older files?

Question 5

5An app sends 20,000 GET requests per second to one prefix and gets 503 Slow Down errors. What is the best fix?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Create a bucket, enable versioning, upload the same file twice with different content, then list its versions.

  2. Exercise 2medium

    Add a lifecycle rule to your bucket that deletes old versions 30 days after they become noncurrent but always keeps the 3 newest old versions, and cleans up unfinished multipart uploads after 7 days.

  3. Exercise 3hard

    Set up Cross-Region Replication from a bucket in us-east-1 to a bucket in eu-west-1, including delete markers, and prove that a new object arrives.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Does S3 have folders?
No. S3 keeps a flat list of keys. The console shows folders by splitting keys on the slash, and the API can do the same with a prefix and a delimiter.
What is the difference between durability and availability in S3?
Durability is the chance your data is not lost, eleven nines for S3 classes. Availability is the chance you can read it right now, for example designed for 99.99 percent in Standard and 99.5 percent in One Zone-IA.
Does versioning cost extra?
The feature itself is free, but every old version is billed as stored data. Use lifecycle rules to expire noncurrent versions you no longer need.
Is S3 Glacier a separate service?
There used to be a separate Glacier service with its own vaults. Today you normally use the Glacier storage classes inside ordinary S3 buckets, chosen at upload or by a lifecycle rule.

Go deeper

ShareXLinkedInWhatsApp