Nov 23, 20266 min read

S3 Storage Classes: Which One to Use

How the Amazon S3 storage classes differ on access latency, minimum storage duration, minimum billable size and retrieval, which one fits uploads, backups, logs and archives, and how lifecycle rules move objects between them.

Illustration for S3 Storage Classes: Which One to Use

Every object in S3 has a storage class, and almost every bucket keeps the default, S3 Standard, for everything, including five-year-old invoices and backups nobody has opened since the day they were written.

The cheaper classes trade price for latency, retrieval fees and minimum billing rules, and those rules decide whether moving data saves money or quietly costs more.

At a glance

ClassAccessMinimum durationMinimum billable sizeTypical use
StandardMillisecondsNoneNoneActive data, anything short-lived
Intelligent-TieringMilliseconds (archive tiers optional)NoneObjects under 128 KB not tieredUnknown or changing access
Standard-IAMilliseconds, retrieval fee30 days128 KBBackups, older user files
One Zone-IAMilliseconds, retrieval fee, single AZ30 days128 KBRe-creatable copies
Glacier Instant RetrievalMilliseconds, retrieval fee90 days128 KBArchives read a few times a year
Glacier Flexible RetrievalMinutes to hours after restore90 daysPer-object metadata overheadCompliance archives
Glacier Deep ArchiveHours after restore180 daysPer-object metadata overheadLong-term retention
Express One ZoneSingle-digit milliseconds, single AZShortNoneLatency-sensitive hot data

How the classes differ

The storage classes guide groups them by access pattern, with Standard as the default for frequently accessed data. Standard-IA and One Zone-IA keep millisecond access for data read rarely, with a per-GB retrieval fee, a 30-day minimum and a 128 KB minimum billable size, and One Zone-IA stores data in a single Availability Zone, so an AZ loss can lose it. The Glacier classes trade more access cost and longer minimums (90 days, or 180 for Deep Archive) for lower storage prices, and Flexible Retrieval and Deep Archive objects must be restored before they can be read.

Express One Zone sits at the other end: a single-AZ class in directory buckets for workloads that need very low latency, such as training data or hot intermediate files, and it is not a cost-saving option for general storage.

The rules that make cheaper classes expensive

  • Minimum duration. Deleting or overwriting a Standard-IA object after 10 days still bills 30. Temporary uploads, build artifacts and anything rewritten often should stay in Standard.
  • Minimum size. Objects under 128 KB are billed as 128 KB in the IA classes and Glacier Instant Retrieval, so thumbnails and small JSON files can cost more there than in Standard.
  • Retrieval fees. A class with cheap storage and per-GB retrieval is a bad fit for data your app reads weekly.
  • Transition requests. Each lifecycle transition is a billed request, which is why the lifecycle transition rules do not move objects smaller than 128 KB by default.

Intelligent-Tiering when you do not know

Intelligent-Tiering charges a small monitoring fee per object and moves objects between Frequent, Infrequent and Archive Instant Access tiers based on actual access, with no retrieval fees, as described in the Intelligent-Tiering documentation. It fits user uploads and data lakes where some objects stay hot for years and others are never touched again, and it is a poor fit for millions of tiny objects, which are not tiered and still pay to be stored.

Moving objects with lifecycle rules

Lifecycle rules transition or expire objects by prefix, tag or age. A typical rule for an uploads bucket keeps originals in Standard for 30 days, moves them to Standard-IA, then to Glacier Instant Retrieval after a year, and leaves derived thumbnails alone:

{ "Rules": [ { "ID": "originals-to-cold", "Status": "Enabled", "Filter": { "Prefix": "originals/" }, "Transitions": [ { "Days": 30, "StorageClass": "STANDARD_IA" }, { "Days": 365, "StorageClass": "GLACIER_IR" } ] }, { "ID": "expire-tmp", "Status": "Enabled", "Filter": { "Prefix": "tmp/" }, "Expiration": { "Days": 2 } } ] }

Apply it with aws s3api put-bucket-lifecycle-configuration --bucket <name> --lifecycle-configuration file://lifecycle.json. Rules work on prefixes, which is why the key layout decides how precise your storage classes can be.

Best fit: Standard for active and short-lived data, Intelligent-Tiering for unpredictable access, IA and Glacier classes only for large objects you keep for months and rarely read.

Buckets and key layout in Encore

Encore

Encore brings infrastructure from code: a bucket declared in a service is provisioned as an S3 bucket in your AWS account, and Encore provisions an IAM role for the service, as the AWS infrastructure docs describe. Storage classes and lifecycle rules are not part of the code-level API, and the infrastructure configuration docs say Encore avoids overwriting changes made in the AWS console, so the useful work in code is a key layout that lifecycle rules can target. This uploads service writes originals, thumbnails and temporary files under separate prefixes:

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

// uploads/uploads.go package uploads import ( "context" "fmt" "path" "time" "encore.dev/beta/auth" "encore.dev/storage/objects" ) var files = objects.NewBucket("user-files", objects.BucketConfig{}) type UploadURLParams struct { Filename string `json:"filename"` } type UploadURL struct { Key string `json:"key"` URL string `json:"url"` } // RequestUpload returns a signed URL for uploading an original file. // Originals live under originals/ so a lifecycle rule can move them to // a colder storage class as they age. // //encore:api auth method=POST path=/uploads func RequestUpload(ctx context.Context, p *UploadURLParams) (*UploadURL, error) { uid, _ := auth.UserID() key := fmt.Sprintf("originals/%s/%s/%s", time.Now().UTC().Format("2006/01"), uid, path.Base(p.Filename)) signed, err := files.SignedUploadURL(ctx, key, objects.WithTTL(10*time.Minute)) if err != nil { return nil, err } return &UploadURL{Key: key, URL: signed.URL}, nil } type Usage struct { Prefix string `json:"prefix"` Objects int64 `json:"objects"` Bytes int64 `json:"bytes"` Small int64 `json:"objects_under_128kb"` } // PrefixUsage reports how much data sits under a prefix, and how many objects // are too small to benefit from an infrequent-access class. // //encore:api private method=GET path=/uploads/usage/:prefix func PrefixUsage(ctx context.Context, prefix string) (*Usage, error) { u := &Usage{Prefix: prefix} for entry, err := range files.List(ctx, &objects.Query{Prefix: prefix + "/"}) { if err != nil { return nil, err } u.Objects++ u.Bytes += entry.Size if entry.Size < 128*1024 { u.Small++ } } return u, nil }

PrefixUsage answers the question that decides a lifecycle rule, whether a prefix is dominated by large objects worth moving or by small ones that would cost more in IA, using data from your own bucket. The object storage docs cover signed URLs and listing, and the endpoint uses auth, so it needs an auth handler in the app. encore run serves the bucket from a local object store, so the key layout and the usage report can be checked before anything is written to S3.

When an AI coding agent adds a new kind of file, the prefix convention in this service tells it where the file goes and which lifecycle rule will apply, and the change stays in one place.

Best fit: services storing user files or exports that want a key layout ready for storage-class rules from day one.

Frequently asked questions

Which S3 storage class should I use?

Use S3 Standard for data your application reads often or that lives less than 30 days. Use Intelligent-Tiering when access patterns are unknown, Standard-IA or Glacier Instant Retrieval for data read rarely but needed in milliseconds, and Glacier Flexible Retrieval or Deep Archive for archives you can wait hours to restore.

What is the minimum storage duration for S3 storage classes?

S3 Standard and Intelligent-Tiering have none. Standard-IA and One Zone-IA bill a minimum of 30 days, Glacier Instant Retrieval and Glacier Flexible Retrieval 90 days, and Glacier Deep Archive 180 days, even if you delete the object earlier.

Do small objects save money in S3 Infrequent Access?

No. Standard-IA, One Zone-IA and Glacier Instant Retrieval bill objects smaller than 128 KB as 128 KB, and lifecycle rules do not transition objects under 128 KB by default. Intelligent-Tiering also keeps them in the Frequent Access tier.

How do I use S3 storage classes with an Encore bucket?

Declare the bucket in code and organize object keys by prefix according to how long they live, such as raw/ and thumbs/. Then add S3 lifecycle rules on those prefixes to move older objects to a cheaper class; Encore provisions the bucket in your AWS account and keeps console changes it does not manage.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders