Sub topic 10
Choosing a storage class
This chapter assumes you can create a bucket, upload objects with the CLI or boto3, and read a JSON policy. You should also know that every S3 object has a key and lives in one bucket.
What a storage class is
A storage class is a property of each object. It sets the price per gigabyte stored, the price of retrieving the object, the minimum time you pay for, and how quickly you can read it back. Durability stays the same across classes: objects are stored across at least three Availability Zones, except the One Zone classes, which use one.
You pick a class per object at upload time, or change it later with a lifecycle rule or a copy.
The main classes
| Class | Best for | Retrieval | Minimum duration |
|---|---|---|---|
| STANDARD | Frequently read data | Milliseconds, no retrieval fee | None |
| INTELLIGENT_TIERING | Unknown or changing access | Milliseconds in its frequent and infrequent tiers | None |
| STANDARD_IA | Data read about once a month | Milliseconds, per-GB retrieval fee | 30 days |
| ONEZONE_IA | Re-creatable data, infrequent reads | Milliseconds, per-GB retrieval fee | 30 days |
| GLACIER_IR | Archives that still need instant reads | Milliseconds, per-GB retrieval fee | 90 days |
| GLACIER (Flexible Retrieval) | Archives read once or twice a year | Minutes to hours | 90 days |
| DEEP_ARCHIVE | Long-term compliance archives | Within hours | 180 days |
Check current prices and limits on the S3 pricing page, because they change.
Setting the class on upload
With boto3, pass the class through ExtraArgs.
import boto3
s3 = boto3.client("s3")
s3.upload_file(
"report.csv",
"my-example-bucket-123456789012",
"reports/2026/report.csv",
ExtraArgs={"StorageClass": "STANDARD_IA"},
)To see which class an object has, call head_object. The StorageClass field is omitted for STANDARD objects.
import boto3
s3 = boto3.client("s3")
head = s3.head_object(
Bucket="my-example-bucket-123456789012",
Key="reports/2026/report.csv",
)
print(head.get("StorageClass", "STANDARD"))How to decide
Ask these questions in order:
- How often will the object be read? Frequent reads favor STANDARD.
- Is the access pattern unknown? INTELLIGENT_TIERING moves objects between tiers for you, for a small per-object monitoring fee.
- Can you wait minutes or hours? If so, the Glacier classes cost much less per gigabyte.
- Can you re-create the data if one Availability Zone is lost? Only then consider ONEZONE_IA.
Common errors
- Small objects in IA classes. The infrequent-access classes bill a minimum object size of 128 KB. Millions of tiny files can cost more there than in STANDARD.
- Early deletion. If you delete or overwrite an object before its minimum duration ends, you still pay for the full period.
- Reading archived objects directly. A
get_objectcall on a GLACIER or DEEPARCHIVE object fails withInvalidObjectState. You must first restore it with `restoreobject`, and the restored copy is temporary. - Transition fees. Each lifecycle transition is a billed request. Moving many small objects can erase the savings.
The next chapters cover versioning and lifecycle rules, which automate moving objects between these classes.
Exercise
A team stores 2 million 20 KB log files that are read once a quarter. A colleague proposes moving them to STANDARD_IA to save money. What problem should you check first?
Show answer
Check the minimum billable object size. STANDARD_IA bills at least 128 KB per object, so each 20 KB file is charged as 128 KB. Storage may cost more than in STANDARD. Also account for the per-request transition fees. Combining the logs into larger archives first would avoid both problems.