Reducing Storage Cost with S3 Storage Classes and Lifecycle Rules
This lesson explains how S3 storage classes and lifecycle rules keep each object in the cheapest class that meets its access needs as it ages, and delete it when it is no longer needed, without manual work.
Learning outcomes
After completing this lesson, you will be able to:
- Choose a storage class from access patterns.
- Write lifecycle transition and expiration rules.
- Identify transition costs and minimum storage durations.
Storage classes
S3 storage classes trade a lower storage price against retrieval cost and speed. S3 Standard suits data accessed frequently, such as the curated and consumption zones. S3 Intelligent-Tiering monitors each object and moves it between access tiers automatically, with no retrieval fees, which suits data whose access pattern is unknown or changing. Standard-IA and One Zone-IA (infrequent access) cost less to store but charge per gigabyte retrieved and bill at least 30 days; One Zone-IA keeps data in a single Availability Zone, so it suits only data that can be recreated.
The Glacier classes are for archives. Glacier Instant Retrieval returns data in milliseconds, Glacier Flexible Retrieval in minutes to hours, and Glacier Deep Archive, the cheapest, within about 12 hours. They have retrieval fees and minimum storage periods of 90 or 180 days. Lifecycle rules move ageing raw data down these classes automatically. The following table summarises the classes.
| Class | Use for |
|---|---|
| S3 Standard | Frequent access |
| Intelligent-Tiering | Unknown or changing access patterns; moves objects between tiers automatically |
| Standard-IA, One Zone-IA | Infrequent access, with retrieval fees and a 30-day minimum |
| Glacier Instant Retrieval, Flexible Retrieval, Deep Archive | Archives: lower storage cost, with retrieval fees, delays and 90 or 180-day minimums |
30days
Minimum billed for Standard-IA and One Zone-IA
90days
Minimum for Glacier Instant and Flexible Retrieval
180days
Minimum for Glacier Deep Archive
12hours
About how long a Deep Archive retrieval takes
Which storage class?
Lifecycle rules
Lifecycle rules manage storage cost automatically, applying to objects selected by prefix or tag. A transition action moves objects to a cheaper storage class after a set age, for example moving raw data to S3 Glacier Flexible Retrieval 90 days after it was processed. An expiration action deletes objects once their retention period ends.
Two further actions clean up storage that is easy to forget. In versioned buckets, rules delete noncurrent versions after a period, so overwritten and deleted objects do not accumulate indefinitely. And rules abort incomplete multipart uploads after a few days, because the parts of uploads that never finished remain stored, and billed, but invisible in ordinary listings.
The following diagram shows each data lake zone's storage classes over seven years.

Lifecycle actions
Points to watch
Lifecycle transitions have costs and constraints that can make a rule more expensive than it looks. Each transition is charged per object, so archiving millions of tiny files can cost more in transition requests than it ever saves in storage; such files should be compacted first.
Colder storage classes also have minimum storage durations, for example 90 days for S3 Glacier Flexible Retrieval, and objects deleted or moved before that period are charged for the remainder. Finally, data that is still queried, for example by Athena, must stay in a class with immediate access, because archive classes require a restore before the data can be read.
Lifecycle pitfalls
A lifecycle policy for each zone
A data lake keeps raw data for seven years for audit, but reads it only when reprocessing. Curated data is queried heavily for a year. The lifecycle rules for each zone are shown in the following table.
| Zone | Lifecycle rule |
|---|---|
| Raw | Transition to Glacier Flexible Retrieval after 90 days; expire after 7 years |
| Curated | Intelligent-Tiering from creation; expire after 3 years |
| Athena query results | Expire after 7 days |
| All buckets | Abort incomplete multipart uploads after 7 days |
Raw files are compacted before transition, because transitions are charged per object. Reprocessing raw data older than 90 days then requires a restore, which the team accepts for audit-only data.
How is data deleted automatically at the end of its retention period?
Show answer
With an S3 lifecycle expiration rule.
Exam Tips
Remember for the exam
- To move cold partitions to Glacier automatically, use a lifecycle transition rule.
- To delete data after its retention period, use lifecycle expiration.
- Unknown or changing access patterns suit S3 Intelligent-Tiering.
- To clean up abandoned uploads, add a rule that aborts incomplete multipart uploads.
- Compact small files before archiving them, because transitions are charged per object.