solidcodersolidcoder
Explore Courses
solidcodersolidcoder
CoursesAboutPrivacy PolicyTerms
© 2026 solidcoder · Practical courses for software engineering interviews.
Home/Machine Coding/Machine coding Tutorial/Machine Coding Question: Design an S3-Like Object Storage System
Chapters — Machine coding Tutorial▾

Machine Coding Question: Design an S3-Like Object Storage System

Machine Coding·Machine Coding Questions·5 min read·Sep 6, 2026

Build a simplified, in-memory version of Amazon S3 — buckets, objects, authentication, access control, and versioning, inspired by S3's flat key-value design.

Asked inAmazonMeesho

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.

Core concepts
Concept
What it is
Bucket
A top-level container, like a root folder. Bucket names must be globally unique across all AWS accounts. All buckets live in a flat namespace — there's no such thing as a bucket inside another bucket.
Object
Every file (image, log, video, PDF) you store. Each object belongs to exactly one bucket, and is identified by its key — a string that looks like a file path, e.g. photos/2024/beach.jpg.
The illusion of folders

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.

What the round tests

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

Three tiers of scope

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

Auth rules
Rule
Detail
Registration
Register users with a username and password.
Login
Users can log in to the system.
Default access
By default, users may only access or manage their own buckets and objects, unless another user grants them access.
Roles
Users can be an admin or a general account user.

2. S3 Service

Create an AWS-S3-like service that manages buckets and objects as its two core resources.

3. Bucket Management

Bucket operations
Operation
What it does
Create Bucket
Create new buckets; names are unique per user.
List Buckets
List all buckets owned by the logged-in user.
Delete Bucket
Delete a bucket, but only if it's empty.

4. Object Management

Object operations
Operation
What it does
Upload
Upload objects (e.g., files) to a bucket.
Download
Download objects from a bucket.
List
List objects within a bucket, showing key, size, and upload timestamp.
Delete
Delete objects from a bucket.
Technical Constraints

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

Bonus — score higher if time allows

Extensibility checks — can your design layer access control and history on top of buckets and objects without a rewrite.

Bonus features
Feature
What to build
Admins
A user who is admin of a bucket can add other users as admin for that same bucket.
Versioning
Keep older versions of an object when it's updated; let users retrieve or roll back to earlier versions.
Access Control
A permission system for bucket and object access, supporting levels like read and write, with the ability to grant or revoke permissions for other users.

Part 3 — Feature Enhancements

Advanced stretch goals — discuss, don't build now

Discuss-only evolution — how the system could grow next.

Advanced stretch goals
Feature
Why it matters
Simulated Folders with Prefixes
Use object keys like photos/2025/summer.jpg and list objects under a given prefix to simulate folders.
Search by Prefix
Find all buckets or objects whose keys start with a given string.
Storage Quotas
Limit total storage size per user or per bucket.

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.
Result

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.

Up next4/4
Part 2 · Machine Coding Questions
←
← Prev Chapter
Snake and Ladder
5 min
This month's launch price
₹30,000₹3,000SOLID50 — 50% OFF

3 years access · 40+ lessons · AI assisted coding

Enroll Now →

Use code SOLID50 at checkout

On this page
  • Machine Coding Task
  • Objective
  • Functional Requirements
    • Part 1 — Basic Requirements
    • Part 2 — Bonus Features
    • Part 3 — Feature Enhancements
  • Example Usage: Full Walkthrough