
Amazon S3 directories are prefixes
A dev.to article explains that S3's 'folders' are naming conventions, incurring unnecessary LIST request costs if treated as real directories [DevTo].
Amazon S3 does not create real directories; the apparent folder hierarchy is a naming convention built on object key prefixes [DevTo]. AWS charges $0.0004 per 1,000 LIST requests in US‑East‑1, making excessive prefix scans costly [AWS Pricing]. When a client issues mc ls bucket/prefix, the service performs a prefix‑based lookup, not a directory traversal. Deleting a 'folder' requires listing all objects that share the prefix and issuing individual DELETE calls, or using the bulk delete API that accepts up to 1,000 keys per request.
Request pricing is real, with each LIST operation billed [AWS Pricing]. Prefixes that are evenly distributed across the key space enable parallel scans, while deep, hierarchical prefixes force the service to scan large contiguous ranges, slowing response times [DevTo]. Cross‑provider compatibility depends on the S3 contract, not on AWS‑specific features. Understanding that the API is the contract, not the underlying filesystem, helps engineers write portable code that avoids vendor‑specific shortcuts [DevTo].
Treating S3 as a key‑value store, not a POSIX filesystem, eliminates hidden costs and simplifies scaling. Designing around prefixes allows for batch deletes, caching known keys in a database, and avoiding needless LIST calls [DevTo].
Subscribe to the broadcast.
Daily digest of the day's most important tech news. No fluff. Engineering signal only.
// delivered via substack · double-opt-in confirmation


