What actually drives your S3 bill beyond per-GB storage?

Per-GB storage is the line item everyone compares. On backends with many small objects or churn, it is often not the line item that dominates. A storage class choice changes up to seven charge types at once:

  • Storage per GB-month, which varies by class.
  • Request charges (PUT, COPY, POST, LIST, GET), billed per thousand requests. They are typically higher for infrequent-access and archive classes.
  • Lifecycle transition requests, billed per object moved. A rule that moves ten million thumbnails costs ten million transitions, whatever their total size.
  • Retrieval fees per GB read from the IA and Glacier classes, plus per-request restore charges for the asynchronous Glacier classes.
  • Minimum storage duration. If you delete or overwrite an object early, you still pay for the remaining days.
  • Minimum billable object size or per-object overhead. Small objects are billed as if they were larger.
  • Intelligent-Tiering's monitoring and automation fee, charged per monitored object rather than per GB.
Storage class Retrieval fee Minimum duration Minimum size / overhead Per-object monitoring fee
Standard No No No No
Intelligent-Tiering No No Objects under 128 KB not monitored or tiered Yes (monitored objects only)
Standard-IA Yes Yes 128 KB minimum No
One Zone-IA Yes Yes 128 KB minimum No
Glacier Instant Retrieval Yes Yes 128 KB minimum No
Glacier Flexible Retrieval Yes, plus restore requests Yes Per-object metadata overhead No
Glacier Deep Archive Yes, plus restore requests Yes Per-object metadata overhead No

Several of these charges scale with object count, and the rest scale with bytes. That means the cheapest class depends on object size distribution and access pattern. A bucket rarely holds one of each, so make the decision per prefix.

How does S3 Intelligent-Tiering work, and why does object size decide whether it pays off?

Intelligent-Tiering is a storage class that decides placement for you. S3 records when each object was last accessed and moves it to a cheaper tier after a period with no access. Any read moves the object back to the frequent tier. The automatic tiers charge no retrieval fee, so a wrong guess costs you nothing beyond the time the object spent in the more expensive tier. Teams use it to avoid predicting access patterns they don't know.

 PUT ──▶ [Frequent Access]
            │  30 days, no access ─────── automatic
            ▼
         [Infrequent Access]
            │  90 days, no access ─────── automatic
            ▼
         [Archive Instant Access]          any GET returns the object
            │                              to Frequent (automatic,
            │                              no retrieval fee)
            │  configured threshold ───── OPT-IN
            ▼
         [Archive Access]        restore required, hours
            │  configured threshold ───── OPT-IN
            ▼
         [Deep Archive Access]   restore required, longer

The monitoring and automation fee is the catch. S3 charges it per object, whether or not the object ever moves to a cheaper tier. Objects below the minimum monitored size (128 KB) are not monitored and are never auto-tiered. They are always billed at the frequent-tier rate, so you get no savings from them. For objects just above the minimum, the per-object fee can exceed what tiering saves on their few bytes. A bucket with many small objects can therefore cost more than plain Standard. Large objects reverse this: the same fee is small next to the per-GB savings.

It suits large objects whose access pattern you don't know. Be cautious with the archive tiers. Once an object is in Archive Access or Deep Archive Access, a GET fails until you restore it. A synchronous read path that worked for months can start returning errors, with no change to your code.

  PUT, object >= 128 KB                  PUT, object < 128 KB
               │                                  │
               ▼                                  ▼
  ┌─────────────────────────┐          ┌─────────────────────────┐
  │ Frequent Access         │◀──┐      │ Frequent-tier rate only │
  └────────────┬────────────┘   │      │ not monitored, no auto- │
               │ AUTO: 30 days  │      │ tiering, no savings     │
               │ no access      │      └─────────────────────────┘
               ▼                │
  ┌─────────────────────────┐   │ AUTO: any GET moves the
  │ Infrequent Access       │───┤ object back, no retrieval fee
  └────────────┬────────────┘   │
               │ AUTO: 90 days  │
               │ no access      │
               ▼                │
  ┌─────────────────────────┐   │
  │ Archive Instant Access  │───┘
  └────────────┬────────────┘
               │ OPT-IN: configured threshold (>= 90 days)
               ▼
  ┌─────────────────────────┐
  │ Archive Access          │   restore required, hours;
  └────────────┬────────────┘   GET fails until restored
               │ OPT-IN: configured threshold (>= 180 days)
               ▼
  ┌─────────────────────────┐
  │ Deep Archive Access     │   restore required, longer;
  └─────────────────────────┘   GET fails until restored

  Monitoring fee: charged per monitored object every month, in every tier.

An object's path through S3 Intelligent-Tiering: the first three tiers move automatically with no retrieval fee, the archive tiers are opt-in and need a restore, and objects under 128 KB are never tiered.

How do you write S3 lifecycle rules scoped by prefix or tag?

Lifecycle rules avoid that surprise because nothing moves unless you wrote a rule that moves it. Each rule in the configuration has an ID, a Status, and a Filter. The filter can match a Prefix, a single Tag, or several conditions combined under And. The actions for a typical backend look like this:

  • Transitions: move logs/ to STANDARD_IA at 30 days, then to GLACIER or DEEP_ARCHIVE at 90.
  • Expiration: delete current versions at 365 days.
  • NoncurrentVersionExpiration: remove superseded versions after NoncurrentDays.
  • AbortIncompleteMultipartUpload: clean up abandoned upload parts after DaysAfterInitiation. Those parts are billed but don't appear in normal listings.

You apply the configuration with aws s3api put-bucket-lifecycle-configuration --bucket <name> --lifecycle-configuration file://lifecycle.json. The call replaces the bucket's entire configuration, so a partial file silently drops every rule it leaves out.

Every transition encodes an assumption about access, for example "nobody reads exports/ after 30 days." When that assumption stops being true, the rule keeps running anyway.

Versioning is the most common leak. In a versioned bucket without a noncurrent-version rule, every overwrite and delete keeps the old bytes. Cost grows whichever storage class you picked.

Drift usually comes from two sources:

  • Overlapping filters. A prefix rule and a tag rule can both match the same object, and S3 resolves the conflict by its own precedence rules, not by what you meant.
  • Undocumented intent. A rule whose purpose nobody recorded becomes one nobody is willing to delete.

Keep the configuration in version-controlled infrastructure code, and add a comment to each rule stating its intent and owner. During an audit or a cost investigation, that comment saves hours of reverse-engineering.

#!/usr/bin/env bash
# Rule intent and owners (JSON has no comments, so they live here, next to each ID):
#   logs-tiering      platform team: logs/ is read for ~30 days, rarely after 90, never after 1 year
#   exports-archive   data team: objects tagged retention=archive are kept but almost never read
#   noncurrent-purge  platform team: keep superseded versions 30 days for rollback, then delete
#   abort-mpu         platform team: abandoned upload parts are billed but hidden; clear after 7 days
set -euo pipefail
BUCKET=example-app-backend-bucket

cat > lifecycle.json <<'EOF'
{
  "Rules": [
    { "ID": "logs-tiering", "Status": "Enabled",
      "Filter": { "Prefix": "logs/" },
      "Transitions": [ { "Days": 30, "StorageClass": "STANDARD_IA" },
                       { "Days": 90, "StorageClass": "GLACIER" } ],
      "Expiration": { "Days": 365 } },
    { "ID": "exports-archive", "Status": "Enabled",
      "Filter": { "And": { "Prefix": "exports/",
                  "Tags": [ { "Key": "retention", "Value": "archive" } ] } },
      "Transitions": [ { "Days": 90, "StorageClass": "DEEP_ARCHIVE" } ] },
    { "ID": "noncurrent-purge", "Status": "Enabled",
      "Filter": { "Prefix": "" },
      "NoncurrentVersionExpiration": { "NoncurrentDays": 30 } },
    { "ID": "abort-mpu", "Status": "Enabled",
      "Filter": { "Prefix": "" },
      "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 } }
  ]
}
EOF

# This call REPLACES the whole lifecycle configuration: every rule must be in the file.
aws s3api put-bucket-lifecycle-configuration \
  --bucket "$BUCKET" \
  --lifecycle-configuration file://lifecycle.json

# Confirm what S3 actually stored.
aws s3api get-bucket-lifecycle-configuration --bucket "$BUCKET"

A version-controlled script that applies prefix- and tag-scoped lifecycle rules for tiering, expiration, noncurrent-version cleanup and multipart-upload aborts, with each rule's intent and owner recorded beside its ID.

Worked example: when does Intelligent-Tiering break even against a lifecycle path to Glacier?

Treat everything here as an illustrative estimate. The inputs are assumptions, and every price is a variable. Substitute current pricing for your region before drawing conclusions.

Assumed inputs: 10,000,000 objects, 200 KB average size (about 2 TB total), 2% of objects read per month, 24-month retention.

Price variables (per GB-month unless noted): P_std, P_ia, P_gl for storage; M for Intelligent-Tiering monitoring per object-month; T_ia and T_gl for transition cost per object; R for retrieval per GB; D_min for each class's minimum storage duration.

Cost component Standard only Intelligent-Tiering Lifecycle: Standard → IA → Glacier
Storage P_std × GB × months Tier rate × GB in each tier × months P_std, then P_ia, then P_gl, each × GB × months spent in that class
Per-object fees None M × objects × months (T_ia + T_gl) × objects, charged once
Reads Request cost only No retrieval fee R × GB read while in IA; restore cost and delay in Glacier
Early deletion None None Charged up to D_min if the object is deleted sooner

Break-even tests

  • Monitoring: Intelligent-Tiering saves money when (P_std − P_tier) × size_GB > M. Solve for size to find the smallest object worth monitoring.
  • Transitions: A transition pays off when T < (P_std − P_target) × size_GB × months_remaining.
  • Minimum duration: If an object's lifetime is shorter than D_min, you pay for D_min anyway. Data that is short-lived should not leave Standard.

Aggregation changes the result

Every per-object term in the table scales with object count, not with bytes. Suppose you bundle the 10 million objects into 1,000 archives of about 2 GB each. Transition and monitoring charges then fall by a factor of 10,000, while the storage term stays the same. For small objects, this packing step often matters more than the choice of storage class.

How do you measure object size and access patterns per prefix before deciding?

Before you pick a strategy for a prefix, measure it. A lifecycle rule written on assumptions often gets rewritten after the first bill, and any objects it already moved can incur minimum-duration and retrieval charges when you reverse course.

S3 Storage Lens shows trends: growth per bucket, storage-class mix, and request activity over time. The free metrics are bucket-level. Prefix-level aggregation requires the paid advanced metrics tier. Use Storage Lens to find which buckets deserve a closer look. It won't tell you the size distribution inside a prefix.

S3 Inventory fills that gap. It writes a daily or weekly listing of every object, including key, size, storage class, and last-modified date, in CSV, ORC, or Parquet format. It is billed per million objects listed. Load the listing into Athena and run a query like the one below. It derives the top-level prefix from the key, assigns each object to a size band (under 128 KB, 128 KB–1 MB, 1–100 MB, larger), and groups by both to return object count and total bytes. That result tells you directly whether Intelligent-Tiering's per-object monitoring fee or per-object transition charges will dominate a given prefix.

Read frequency needs request data. Server access logs cost nothing to enable, but you pay to store and query them, and AWS delivers them on a best-effort basis. CloudTrail data events are more complete and structured, but they are billed per event. On a hot bucket, that charge can rival the savings you are trying to find. Scope data events to the specific prefixes you are evaluating, run them for a representative window, then turn them off.

-- Size distribution per top-level prefix from one S3 Inventory snapshot.
-- Assumes an Athena table built over Parquet/ORC inventory output,
-- partitioned by dt (CSV inventory keys are URL-encoded; decode first).
SELECT
  CASE
    WHEN strpos(key, '/') > 0 THEN split_part(key, '/', 1)
    ELSE '(root)'
  END AS top_prefix,
  CASE
    WHEN size < 131072 THEN '1: <128KB'         -- below IT auto-tiering minimum
    WHEN size < 1048576 THEN '2: 128KB-1MB'
    WHEN size < 104857600 THEN '3: 1MB-100MB'
    ELSE '4: >100MB'
  END AS size_band,
  storage_class,
  count(*) AS object_count,
  sum(size) AS total_bytes,
  round(sum(size) / 1073741824.0, 2) AS total_gib,
  -- Rough age signal; it is not access frequency.
  min(last_modified_date) AS oldest_modified
FROM s3_inventory.example_bucket_inventory
WHERE dt = '2026-11-10-01-00'  -- pin a single daily snapshot
GROUP BY 1, 2, 3
ORDER BY top_prefix, size_band, storage_class;

An Athena query over an S3 Inventory table that groups one snapshot by top-level prefix, size band, and storage class, returning object counts and bytes so you can see whether per-object fees or per-GB savings dominate each prefix.

When should you avoid Glacier, and what do restores mean for application code?

Archiving is the wrong move for three kinds of prefixes. The first is data read on a request path, because the asynchronous Glacier classes cannot serve a synchronous read. The second is short-lived or frequently rewritten objects. Minimum storage duration charges bill a deleted or overwritten object as if it had stayed the full period, so a nightly-replaced export in Glacier Flexible Retrieval pays the minimum again on every rewrite. The third is prefixes with unpredictable reads, where per-GB retrieval fees and per-request restore charges can cancel the storage savings after a few bulk reads.

Glacier Instant Retrieval behaves differently from the other two classes. It serves GetObject in milliseconds with no restore step. You pay a higher per-GB retrieval fee and still owe a minimum duration. Glacier Flexible Retrieval and Glacier Deep Archive are asynchronous. A GetObject call on an unrestored object fails with InvalidObjectState. You first call aws s3api restore-object with a number of days and a retrieval tier. Expedited is the fastest and most expensive. Standard is the middle option. Bulk is the cheapest and slowest. Deep Archive does not offer Expedited.

The restore creates a temporary copy that expires after the requested days. You poll its status with aws s3api head-object. Its Restore field reads ongoing-request="true" while the restore is in progress, then ongoing-request="false" along with an expiry date.

Application code needs an explicit state for this: request the restore, return "pending" to the caller, and resume once the copy is ready, either through polling or an S3 event notification. Runbooks need it too. If incident data might be archived, the runbook should list which prefixes require a restore and which tier to use, so on-call engineers know they may wait hours and do not discover this during an outage.

#!/usr/bin/env bash
# Restore one archived object (Glacier Flexible Retrieval or Deep Archive)
# and wait until the temporary copy is readable.
set -euo pipefail

BUCKET="example-incident-logs"
KEY="app/2024/03/14/requests.log.gz"
TIER="Standard"  # Expedited | Standard | Bulk (Deep Archive: Standard or Bulk only)
DAYS=3            # how long the temporary restored copy stays readable

# Asynchronous request: this returns before any data is available.
# If a restore is already running, S3 returns RestoreAlreadyInProgress; treat that as fine.
aws s3api restore-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --restore-request "{\"Days\":${DAYS},\"GlacierJobParameters\":{\"Tier\":\"${TIER}\"}}" \
  || echo "restore-object failed or restore already in progress; checking status"

# Poll the Restore header. A real job can take hours, so poll sparingly.
while true; do
  STATUS=$(aws s3api head-object --bucket "$BUCKET" --key "$KEY" \
    --query Restore --output text)
  echo "$(date -u +%FT%TZ) Restore: $STATUS"

  case "$STATUS" in
    *'ongoing-request="false"'*)
      echo "Restored copy is ready; GetObject will now succeed until expiry-date."
      break ;;
    *'ongoing-request="true"'*)
      sleep 900 ;;  # still in progress; check again in 15 minutes
    *)
      echo "No restore recorded for this object; check the key and storage class." >&2
      exit 1 ;;
  esac
done

aws s3 cp "s3://${BUCKET}/${KEY}" ./requests.log.gz

An on-call script that asks S3 to restore an archived object with a chosen retrieval tier, then polls head-object until the Restore field reports ongoing-request="false" and downloads the copy.

Which strategy fits each backend data type? A per-prefix decision checklist

Those operational constraints feed directly into the per-prefix choice. Most backends hold several data types with very different access curves, so one bucket-wide policy usually overpays somewhere.

Data type Recommended strategy Alternative Why
User uploads (unpredictable reads) Intelligent-Tiering for large objects Standard for small-object prefixes Monitoring fees are per object, so savings only exceed fees when objects are large
Application logs, audit trails Lifecycle: Standard-IA, then Glacier, then expiration Glacier directly if logs are never queried Reads decay predictably with age, so fixed transitions avoid monitoring fees
Database backups, snapshots Lifecycle to Glacier, expiration matched to retention policy Standard-IA for the most recent restore points Recent backups need fast restores. Older ones only satisfy retention
Build artifacts Short expiration, stay in Standard None They are deleted before any transition could save money
ML datasets Depends on object size and training cadence Aggregate small files into archives first Frequent retraining keeps data hot, and many small files inflate request and monitoring costs

Checklist per prefix

  • Object size: Are most objects large enough that per-object fees stay small next to the per-GB savings?
  • Access predictability: Does read frequency fall off with age? If so, use lifecycle rules. If it doesn't, use Intelligent-Tiering.
  • Retention requirements: Does expiration enforce your legal or policy minimums? Is it also not longer than they require?
  • Retrieval delay tolerance: Can callers wait hours for a restore?
  • Versioning: Do rules transition and expire noncurrent versions, or do the old versions build up in Standard and keep being billed?

Each per-prefix rule costs something. It is one more piece of configuration to review, test, and keep aligned when prefixes are renamed or new data types arrive. Write separate rules for the prefixes that hold most of your bytes. Let the small, low-volume prefixes share a simple default.

How OneEnv can help

Disclosure: OneEnv is the product behind this blog.

OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.

Applied to s3 intelligent tiering cost, this is where it helps:

Saves time

  • Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
  • One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
  • Changing a shared variable is one edit and one review instead of editing every service's .env by hand.

Saves cost

  • Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
  • Less duplicated configuration to maintain: one shared definition inherited by many services.
  • A wrong or stale value is caught at review time by the services it affects, not by a failed deploy.
  • OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.

These are qualitative benefits, not measured results — how much you save depends on how many services share the value.

Want to try it? Start at oneenv.io.