Machine Coding Question: Design an S3-Like Object Storage System
Build a simplified, in-memory version of Amazon S3 — buckets, objects, authentication, access control, and versioning, inspired by S3's flat key-value design.
Amazon S3 (Simple Storage Service) is one of the world's most widely used cloud storage systems. It offers a scalable, highly durable, and cost-effective way to store and retrieve any amount of data — from small JSON logs to massive media archives. At the heart of S3 are two simple concepts: buckets and objects.
S3 doesn't have real folders or subfolders. Something that looks like this:
photos/
└── 2024/
├── beach.jpg
└── mountain.jpg
docs/
└── report.pdf
is actually just three objects, each with a key — photos/2024/beach.jpg, photos/2024/mountain.jpg, docs/report.pdf. The / is part of the key string with no structural meaning; the S3 console and SDKs split keys on / to simulate folders, but behind the scenes S3 is a flat, massive, distributed key-value store.
Machine Coding Task
Your challenge: implement an in-memory object storage service inspired by S3. You'll handle buckets, objects, authentication, and basic access controls — while following clean design principles.
This one tests whether you can design a clean key-value storage abstraction, layer ownership and access control on top of it, and keep the whole thing thread-safe for concurrent users — without ever needing folders as a first-class concept.
Objective
The primary objective of this project is to design and implement a simplified, in-memory S3-like object storage service that supports user authentication, per-user bucket ownership, object upload/download/listing/deletion, and — as the design matures — access control and versioning.
Functional Requirements
Requirements are split into three tiers so you know what to prioritize under time pressure: build first, build if time allows, and discuss only.
Part 1 — Basic Requirements
Core functionality you must build and get working first.
1. User Authentication
2. S3 Service
Create an AWS-S3-like service that manages buckets and objects as its two core resources.
3. Bucket Management
4. Object Management
Everything must be stored in memory (no external DB). The design must be thread-safe to support concurrent users, built with clean, modular, object-oriented design, and left open to adding further AWS-style services in the future.
Part 2 — Bonus Features
Extensibility checks — can your design layer access control and history on top of buckets and objects without a rewrite.
Part 3 — Feature Enhancements
Discuss-only evolution — how the system could grow next.
Example Usage: Full Walkthrough
Here's how a sample session might run end-to-end, one step at a time.
1. Register and log in
> register --username alice --password ****
✅ User 'alice' registered successfully.
> login --username alice --password ****
✅ Login successful. Welcome, alice!
2. Create a bucket
> create-bucket --name alice-photos
✅ Bucket 'alice-photos' created.
> list-buckets
📦 Buckets owned by alice:
- alice-photos
3. Upload objects
> upload --bucket alice-photos --key photos/2024/beach.jpg --file beach.jpg
✅ Uploaded 'photos/2024/beach.jpg' (2.4 MB)
> upload --bucket alice-photos --key photos/2024/mountain.jpg --file mountain.jpg
✅ Uploaded 'photos/2024/mountain.jpg' (3.1 MB)
4. List objects in the bucket
> list-objects --bucket alice-photos
📄 Objects in 'alice-photos':
- photos/2024/beach.jpg 2.4 MB 2026-09-08 10:12:03
- photos/2024/mountain.jpg 3.1 MB 2026-09-08 10:12:41
5. Download and delete an object
> download --bucket alice-photos --key photos/2024/beach.jpg
✅ Downloaded 'photos/2024/beach.jpg' to ./beach.jpg
> delete-object --bucket alice-photos --key photos/2024/beach.jpg
✅ Deleted 'photos/2024/beach.jpg'
6. Attempt to delete a non-empty bucket
> delete-bucket --name alice-photos
❌ Error: Bucket 'alice-photos' is not empty. Delete all objects first.
7. Empty the bucket, then delete it
> delete-object --bucket alice-photos --key photos/2024/mountain.jpg
✅ Deleted 'photos/2024/mountain.jpg'
> delete-bucket --name alice-photos
✅ Bucket 'alice-photos' deleted.
Alice registers, logs in, and manages a bucket end to end — creating it, uploading and listing objects by key, downloading one, and deleting objects before the (now-empty) bucket itself is removed. The attempt to delete a non-empty bucket is correctly rejected.