Not all files are used the same way: some you access daily, others almost never, but you still need to keep them. It would be absurd to pay the same for both. That's why S3 offers several storage classes: different "levels" with varying costs and access speeds. Choosing the right class can drastically reduce your storage bill.

The central idea: cost vs. access frequency

The rule is simple:

The less you access a file, the cheaper it can be to store it… but retrieving it costs more time or money.

Frequent access ◄──────────────────────────► Almost never accessed
  S3 Standard      S3 Standard-IA       Glacier (archive)
  (expensive to     (medium)            (super cheap to store,
   store, free                          slow/expensive to recover)
   to read)

Analogy: Think about your belongings.

  • What you use daily is on your desk (instant access, but desk space is "expensive"). → Standard.
  • What you use occasionally you keep in a drawer (a bit more effort). → IA.
  • What you almost never use but must keep (old documents) you put in boxes in the storage room (super cheap, but takes time to retrieve). → Glacier.

The main classes

S3 Standard — everyday use

  • For: frequently accessed data.
  • Storage cost: the highest.
  • Access: instant, no extra recovery cost.
  • Typical use: files for an active website, app images, data that is read often.

S3 Standard-IA (Infrequent Access) — infrequent access

  • For: data you need to have instantly available, but access only a few times a month.
  • Storage cost: cheaper than Standard.
  • But: you pay a small fee each time you retrieve an object.
  • Typical use: recent backups, files you might suddenly need but not daily.

S3 One Zone-IA — cheaper, less resilient

  • Same as Standard-IA but stores data in a single availability zone (instead of several).
  • Cheaper, but if that AZ has a serious issue, you could lose the data.
  • Typical use: data you can regenerate if lost (secondary backups, thumbnails you can recreate).

S3 Glacier — long-term archive

The Glacier family is for archiving data you almost never access but must keep (for example, for legal reasons). There are variants depending on how quickly you need to recover them:

Variant Recovery time Cost
Glacier Instant Retrieval Milliseconds (instant) Cheap to store
Glacier Flexible Retrieval Minutes to hours Cheaper
Glacier Deep Archive Hours (up to ~12 h) The cheapest of all
  • Typical use: historical files, backups from years ago, records that must be kept 7-10 years by law.

Real example: A hospital must keep medical records for 15 years by law, but rarely accesses them. They store them in Glacier Deep Archive: they pay a minimal amount to store them and, if they ever need one, accept waiting a few hours to recover it. The savings compared to Standard are huge.

S3 Intelligent-Tiering — let AWS decide for you

If you don't know how often your data will be accessed, this class automatically moves each object to the cheapest tier based on usage. You do nothing; AWS optimizes the cost for you (in exchange for a small monitoring fee).

  • Typical use: data with unpredictable or changing access patterns. It's a "safe and convenient" option when in doubt.

Summary table

Class Access Storage cost Recovery cost Ideal for
Standard Frequent, instant High Free Active day-to-day data
Standard-IA Infrequent, instant Medium Read fee Recent backups
One Zone-IA Infrequent, 1 AZ only Lower Read fee Regenerable data
Glacier Instant Archive, instant Low Fee Archive you sometimes access
Glacier Flexible Archive, minutes/hours Very low Fee Historical archive
Glacier Deep Archive Archive, hours Lowest Fee Long-term legal retention
Intelligent-Tiering Automatic Variable Automatic Unpredictable access

How classes are assigned

You can assign the class of an object when uploading it, or let them move automatically over time using lifecycle rules (we'll see this in subchapter 5.3). For example: "files move to IA after 30 days and to Glacier after 90". This way you optimize costs automatically without touching anything.

What you should remember

  • S3 offers several storage classes that balance cost and speed/cost of access.
  • Standard for day-to-day data; Standard-IA for infrequent access; Glacier for long-term archive (the deeper, the cheaper but slower to recover).
  • One Zone-IA saves money at the cost of less resilience (regenerable data).
  • Intelligent-Tiering lets AWS optimize cost automatically when you don't know the access pattern.
  • Lifecycle rules move objects between classes automatically.

In the next subchapter we'll look at versioning (keeping multiple versions of an object) and lifecycle (automating class transitions and deletion), two key S3 features.

Cloud, AWS & Terraform — From Zero to Expert

Chapter 1 · What is cloud computing

Chapter 2 · The cloud market and major providers

Chapter 3 · Regions, availability zones and edge

Chapter 4 · Compute: EC2

Chapter 5 · Storage: S3

Chapter 6 · Networking: VPC

Chapter 7 · Identity and access: IAM

Chapter 8 · Managed databases

Chapter 9 · Why Infrastructure as Code

Chapter 10 · HCL: the Terraform language

Chapter 11 · Providers and state

Chapter 12 · Your first real infrastructure in Terraform

Chapter 13 · Load balancing and auto scaling

Chapter 14 · Serverless with Lambda

Chapter 15 · Messaging and events

Chapter 16 · Content delivery and DNS

Chapter 17 · Containers on AWS

Chapter 18 · Modules: reuse and composition

Chapter 19 · Workspaces and environment management

Chapter 20 · Remote backends and locking

Chapter 21 · Infrastructure testing

Chapter 22 · Terraform in CI/CD

Chapter 23 · Defense in depth

Chapter 24 · Observability: logs, metrics and traces

Chapter 25 · Cost optimization

Chapter 26 · High availability and disaster recovery

Chapter 27 · AWS Well-Architected Framework

Chapter 28 · Serverless architectures at scale

Chapter 29 · Data platforms on AWS

Chapter 30 · Multi-account and landing zones

Chapter 31 · Platform Engineering and Internal Developer Platform

Chapter 32 · Relevant AWS certifications

Chapter 33 · Projects to consolidate what you've learned

Chapter 34 · Resources and community

© Copyright 2024. All rights reserved