๐ŸŽ‰ 75% of content is free forever โ€” Unlock Premium from $10/mo โ†’
CW
NEWSLIVESearch All Content
๐Ÿ’ผ Servicesโ„น๏ธ Aboutโœ‰๏ธ ContactView Pricing Plansfrom $10

Amazon S3 Storage Classes, Lifecycles and Performance

AWS Data EngineeringS3 Storage, Lifecycle & Performanceโญ Premium
AWS Data Engineering ยท Interview

The one-line mental model

S3 is a flat key-value object store that only pretends to be a filesystem, and nearly every cost, performance and durability decision in a data lake comes from understanding how prefixes, storage classes and request patterns interact.

After this lesson you will be able to size a storage bill before you build, write a lifecycle rule that does not strand data, choose an encryption mode that satisfies an auditor, and explain why a lake with millions of tiny files queries slowly no matter how many bytes it holds.

Prerequisites

  • !Basic AWS vocabulary: accounts, regions, IAM and the shared responsibility model
  • !Comfort with columnar file formats such as Parquet

What You'll Learn

  • 1Map access patterns to storage classes and retrieval costs
  • 2Author lifecycle transitions and expiration rules deliberately
  • 3Compare SSE-S3, SSE-KMS and SSE-C on control and audit needs
  • 4Tune prefixes, multipart uploads and file sizes for throughput

Buckets, keys and why flat beats deep

An S3 bucket holds objects, each addressed by a key such as raw/orders/dt=2026-03-01/part-0000.parquet. There are no real directories, only slashes inside keys, which means the layout you choose is a convention you impose rather than a constraint S3 enforces. That freedom matters because S3 scales horizontally by spreading requests across prefixes: a single hot prefix can throttle while five hundred evenly used prefixes absorb the same load comfortably.

Three numbers are worth memorising for interviews and for capacity planning. Objects scale to five terabytes each, with single PUT requests capped at five gigabytes and everything larger uploaded in parts. Durability is eleven nines of annual probability of loss, achieved by replicating each object across multiple devices in at least three availability zones for Standard. Availability varies by class, from 99.99% for Standard down to 99.5% for One Zone-IA, which stores a single copy in one zone and is therefore only appropriate for data you can recreate.

The practical consequence for data engineers is that your prefix design is your throughput design. Hive-style partitioning such as year=2026/month=03/day=01 gives analytics engines the ability to skip entire partitions, while spreading ingestion across a handful of well-chosen sub-prefixes keeps any one path from becoming a bottleneck during heavy parallel writes.

Choosing a storage class by access pattern, not by price

The cheapest per-gigabyte rate is rarely the cheapest bill, because every class carries a different retrieval and minimum-duration charge. Choose by what you actually read and how fast you need it back.

Storage classAvailabilityMinimum durationRetrieval speedTypical monthly rateUse it for
S3 Standard99.99%NoneMillisecondsAround $0.023/GBHot fact tables and active staging
Intelligent-Tiering99.9%None, small monitoring feeMillisecondsTier dependentUnknown or erratic access patterns
Standard-IA99.9%30 daysMillisecondsAround $0.0125/GBMonthly-close and audit archives
One Zone-IA99.5%30 daysMillisecondsAround $0.01/GBReproducible intermediates
Glacier Instant Retrieval99.9%90 daysMillisecondsAround $0.004/GBQuarterly archives read rarely
Glacier Flexible Retrieval99.99%90 daysMinutes to hoursAround $0.0036/GBCompliance archives, occasional pulls
Glacier Deep Archive99.99%180 days12 to 48 hoursUnder $0.001/GBSeven-year retention, restore rarely

Intelligent-Tiering is the answer when nobody can predict access: it watches each object for thirty days and moves it between automatic tiers, charging a small per-gigabyte monitoring fee instead of imposing retrieval penalties. It is not a substitute for lifecycle rules on data you know is cold, because the frequent-access tier still costs Standard rates until the observation window closes.

Always model retrieval, not just storage. A Glacier Flexible restore that must finish within an hour costs meaningfully more than a patient one, and a surprise bill from an unplanned bulk restore during an incident is a rite of passage worth avoiding by testing your archive policy once a year.

Lifecycle rules that earn their keep

Lifecycle configuration is JSON attached to a bucket that automates transitions and expiration. The rule below encodes a realistic data lake policy: hot for a quarter, infrequent for half a year, archive for two years, and a hard stop afterwards.

{
  "Rules": [
    {
      "ID": "raw-zone-lifecycle",
      "Status": "Enabled",
      "Filter": { "Prefix": "raw/" },
      "Transitions": [
        { "Days": 90, "StorageClass": "STANDARD_IA" },
        { "Days": 180, "StorageClass": "GLACIER" },
        { "Days": 730, "StorageClass": "DEEP_ARCHIVE" }
      ],
      "Expiration": { "Days": 2555 }
    },
    {
      "ID": "abort-incomplete-multipart",
      "Status": "Enabled",
      "Filter": {},
      "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
    }
  ]
}

The second rule is the one most teams discover only after a bill: interrupted multipart uploads leave parts in the bucket indefinitely, each billed at Standard rates, and without an abort rule they accumulate forever. Transitions evaluate once a day and execute asynchronously, so expect up to a day of lag, and remember that objects must reach the minimum age of their target class or the transition is rejected. Expiration deletes objects and, with versioning enabled, expires non-current versions as well, which is how you keep the storage savings of versioning from erasing the benefit of your lifecycle policy.

Encryption options and which one an auditor accepts

Server-side encryption means S3 encrypts data at rest with an AES-256 key and decrypts it transparently on read. The four options differ in who controls the key and whether usage leaves an audit trail.

MethodKey controlAudit trail via CloudTrailCostWhen to choose it
SSE-S3AWS manages entirelyNoFreeInternal data with no compliance driver
SSE-KMSCustomer-managed key in KMSYes, every decrypt loggedKey and API chargesRegulated data and any PII
SSE-CCaller supplies the key per requestNoFreeLegacy systems that already hold keys
Client-sideYou encrypt before uploadDepends on your toolingFreeMaximum control, full complexity

SSE-KMS with a bucket key enabled is the default recommendation for a data platform. The bucket key drastically reduces KMS request charges by wrapping one data key for many objects, while every use of the underlying key still lands in CloudTrail, which is exactly the evidence an auditor asks for. Enforce encryption at rest as a bucket policy condition as well as a default encryption setting, so an object written with an explicit weaker header is rejected rather than silently stored.

{
  "Rules": [
    {
      "ApplyServerSideEncryptionByDefault": {
        "SSEAlgorithm": "aws:kms",
        "KMSMasterKeyID": "arn:aws:kms:us-east-1:123456789012:key/1234abcd-key"
      },
      "BucketKeyEnabled": true
    }
  ]
}

Throughput: prefixes, multipart and file size

Raw bandwidth is rarely the limit in a data lake; request overhead and file size are. S3 scales to at least thirty-five hundred PUT, COPY, POST or DELETE requests per second per prefix and one hundred GET requests per second, so the usual fix for slow ingestion is spreading writes across prefixes rather than buying a bigger instance.

python
import boto3
from boto3.s3.transfer import TransferConfig

s3 = boto3.client("s3")

config = TransferConfig(
    multipart_threshold=100 * 1024 * 1024,
    multipart_chunksize=100 * 1024 * 1024,
    max_concurrency=10,
    use_threads=True,
)

s3.upload_file(
    "orders-2026-03.parquet",
    "acme-data-lake",
    "raw/orders/dt=2026-03-01/orders-2026-03.parquet",
    Config=config,
)

paginator = s3.get_paginator("list_objects_v2")
small = 0
for page in paginator.paginate(Bucket="acme-data-lake", Prefix="raw/orders/"):
    for obj in page.get("Contents", []):
        if obj["Size"] < 128 * 1024 * 1024:
            small += 1
print(f"{small} files below 128 MB should be compacted")

Multipart upload matters twice: it enables parallel transfer of large objects, and it allows an incomplete upload to be resumed or aborted. Below the hundred-megabyte threshold the overhead of coordination outweighs the benefit. On the read side, the sweet spot for columnar files is roughly two hundred and fifty megabytes to one gigabyte per object, which gives engines enough parallelism to distribute work while keeping the per-object open and planning cost small. Files under a few megabytes are the classic hidden tax: Athena charges per data scanned and per file handled, so a partition containing ten thousand tiny files costs far more to query than one file of the same total size.

A bucket layout that survives real workloads

Structure the lake by trust level rather than by source system, because the transformation stage determines who may read the data and how long it must be kept.

Architecture Diagram
s3://acme-data-lake/
โ”œโ”€โ”€ raw/                      # immutable landing zone, partitioned by date
โ”‚   โ””โ”€โ”€ orders/dt=2026-03-01/
โ”œโ”€โ”€ processed/                # cleansed, deduplicated, typed
โ”‚   โ””โ”€โ”€ orders/dt=2026-03-01/
โ”œโ”€โ”€ curated/                  # modelled tables registered in Glue
โ”‚   โ”œโ”€โ”€ dim_customer/
โ”‚   โ””โ”€โ”€ fact_order/
โ”œโ”€โ”€ aggregate/                # pre-computed marts for dashboards
โ”œโ”€โ”€ archive/                  # Glacier target for expired raw data
โ”œโ”€โ”€ _checkpoints/             # streaming offsets and job state
โ””โ”€โ”€ _quarantine/              # records rejected by quality gates

Raw stays write-once so a replay can always reproduce history. Processed is where cleaning happens and is safe to overwrite by partition. Curated tables are the contract with consumers and should be registered in the Glue Data Catalog with statistics refreshed, because Athena's optimiser depends on them. The quarantine path is underrated: routing bad records aside instead of failing the whole load keeps ingestion alive while giving data quality something concrete to alert on.

The security baseline before you go live

Turn on Block Public Access at the account level as well as per bucket, so a single mis-scoped policy cannot expose the lake. Require TLS with a bucket policy condition denying non-HTTPS requests. Enable server access logging and CloudTrail data events for the buckets that hold regulated data, and ship both to a separate account so an attacker in the data account cannot erase evidence. Enable versioning when you need recovery from overwrite or delete, and pair it with Object Lock in compliance mode if a regulation demands write-once retention. For cross-account analytics, prefer bucket policies scoped to named roles over ACLs, and reach for Lake Formation when access must be granted at the table or column level rather than the whole prefix. Finally, use pre-signed URLs for time-boxed sharing instead of making objects public, and review them like you would review a password.

Common Mistakes

Leaving every object in S3 Standard forever

Fix: Attach lifecycle transitions so cold prefixes age into IA and Glacier automatically

Ignoring incomplete multipart uploads

Fix: Add an abort rule after seven days so abandoned uploads stop billing

Ingesting thousands of small files per partition

Fix: Batch or compact writes to 256 MB or larger objects before publication

Relying on default encryption with no audit trail

Fix: Use SSE-KMS with a bucket key and deny unencrypted or non-TLS writes in bucket policy

Best Practices

  • Design prefixes for both partition pruning and request distribution
  • Enable versioning, lifecycle rules and Block Public Access on every new bucket
  • Model total cost including requests, retrieval and data transfer, not just per-GB rates
  • Register curated paths in the Glue catalog and keep table statistics current
  • Test an archive restore from Glacier on a schedule so the recovery time is known

Interview Questions

Q1: S3 Standard or Intelligent-Tiering for a table with unpredictable access?

Intelligent-Tiering, because it reclassifies objects after thirty days of observation with no retrieval fees, whereas Standard-IA would incur minimum-duration and retrieval charges on surprise reads.

Q2: How do lifecycle policies interact with versioning?

They can expire non-current versions and abort incomplete uploads, which is how you keep versioning enabled without letting old versions dominate the bill.

Q3: Why does a data lake with lots of small files query slowly?

Analytics engines pay per object and per byte scanned, so file-open overhead dominates and parallelism is wasted on coordination rather than data.

Q4: What does a bucket key do?

It wraps a single KMS data key for many objects in the bucket, cutting KMS API charges dramatically while preserving per-request audit logging of the underlying key.

Key Takeaways

  • S3 is flat: prefix design determines both query pruning and request throughput
  • Choose storage classes by access pattern and retrieval SLA, then automate movement with lifecycle rules
  • Always abort incomplete multipart uploads and budget for requests as well as gigabytes
  • SSE-KMS with a bucket key gives compliance evidence without prohibitive cost
  • Small files are a query tax; compact to the 256 MB to 1 GB range before publishing tables
๐Ÿ”’

Premium Content

Amazon S3 Storage Classes, Lifecycles and Performance

You've previewed the first section. Unlock this full lesson and 900+ advanced tutorials with a Premium plan.

๐ŸŽฏEnd-to-end Projects
๐Ÿ’ผInterview Prep
๐Ÿ“œCertificates
๐ŸคCommunity Access

Already a member? Log in

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-13

โ€”
โ˜†โ˜†โ˜†โ˜†โ˜†
0 ratings

Rate & Feedback

Advertisement