CLOUD & INFRASTRUCTURE / SYSTEM CONCEPT BRIEF

Amazon S3

Amazon S3 (Simple Storage Service) is object storage: you put objects (files up to 5 TB) into buckets under keys, and retrieve them over HTTPS.

BeginnerPhase 07 / Topic 5 of 17RequirementsTrade-offsFailure modes
01

Overview

Amazon S3 (Simple Storage Service) is object storage: you put objects (files up to 5 TB) into buckets under keys, and retrieve them over HTTPS. It is designed for 99.999999999% durability by storing data redundantly across multiple availability zones, scales to virtually unlimited size, and has been strongly consistent for reads after writes since 2020.

S3 is the backbone of countless systems: media storage, static website hosting behind CloudFront, backups, data lakes, logs, and ML datasets. Key features include storage classes, lifecycle rules, versioning, replication, event notifications, pre-signed URLs, encryption, and fine-grained access control with Block Public Access by default.

An infinitely large, labeled storage warehouse

You hand over a box with a label (key), and the warehouse keeps copies in several buildings. Anyone you authorize can fetch the box by its label, and you can set rules to move old boxes to cheaper back rooms.

02

When to use it

  • User uploads, images, and video.
  • Static assets and website hosting with a CDN.
  • Backups, archives, and logs.
  • Data lakes queried by Athena, Spark, or warehouses.
03

Where it shows up in interviews

Direct uploads

Recognize it when: clients upload large files.

  • Design Dropbox
  • Design Instagram uploads
Event-driven processing

Recognize it when: process files when they arrive.

  • Design thumbnail generation
  • Design a data ingestion pipeline
04

Where it is used in real software

Netflix, Airbnb, Pinterest

Store media, logs, and data lakes in S3 at petabyte to exabyte scale.

Static sites

S3 plus CloudFront hosts single-page apps and documentation sites.

S3 Express One Zone

Single-digit millisecond storage class for high-performance workloads like ML training.

05

Key terms

Bucket / key / object
Container / name / data plus metadata.
Pre-signed URL
Time-limited URL granting access to one object operation.
Versioning
Keep every version of an object; protects against deletes.
Storage classes
Standard, Intelligent-Tiering, IA, Glacier tiers.
Multipart upload
Upload large objects in parallel parts.
06

How it works, step by step

  1. 1
    Client asks the API for an upload URL

    API authorizes and returns a pre-signed PUT URL.

  2. 2
    Client uploads directly to S3

    No file bytes pass through your servers.

  3. 3
    S3 emits an event

    To SQS, SNS, EventBridge, or Lambda.

  4. 4
    Workers process the object

    Thumbnails, virus scan, metadata extraction.

  5. 5
    Serve via CloudFront

    With origin access control; the bucket stays private.

Direct upload with pre-signed URL
Step 1 / 4
Browser
API
S3
Event queue
Worker
CloudFront

STEP 1The browser requests an upload URL for photo.jpg; the API checks permissions.

07

S3 storage classes

Pick by access frequency

Step 1 / 5
ClassAccess patternRetrievalRelative cost
StandardFrequentMillisecondsHighest storage
Intelligent-TieringUnknown or changingMillisecondsAuto-optimized
Standard-IAMonthlyMilliseconds, retrieval feeLower
Glacier Instant / FlexibleQuarterly / yearlyms / minutes-hoursMuch lower
Glacier Deep ArchiveRarely (compliance)Up to 12-48 hoursLowest

NOWClass: Standard | Access pattern: Frequent | Retrieval: Milliseconds | Relative cost: Highest storage

Lifecycle rules move objects between classes automatically as they age.

08

Implementation

import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";import { getSignedUrl } from "@aws-sdk/s3-request-presigner";import { randomUUID } from "node:crypto"; const s3 = new S3Client({}); export async function createUploadUrl(userId: string, contentType: string) {  if (!["image/jpeg", "image/png", "image/webp"].includes(contentType)) throw new Error("Unsupported type");  const key = `uploads/${userId}/${randomUUID()}`;            // never trust client file names as keys  const url = await getSignedUrl(    s3,    new PutObjectCommand({ Bucket: process.env.UPLOAD_BUCKET, Key: key, ContentType: contentType }),    { expiresIn: 300 },                                         // 5 minutes  );  return { url, key };}
09

Complexity and performance

Durability11 nines

Across 3+ AZs.

Max object5 TB

Single PUT up to 5 GB.

Request rate3,500 PUT / 5,500 GET per s per prefix

Parallelize with prefixes.

10

Trade-offs

Cheap and durable vs latency

S3 is ideal for large objects but slower than local disks or caches for small, frequent reads; put a CDN or cache in front.

Request costs

Millions of tiny objects cost more in requests; batch small records into larger files.

11

Variants and related techniques

S3-compatible stores

MinIO, Cloudflare R2, Google Cloud Storage, Azure Blob.

S3 Object Lock

Write-once-read-many for compliance and ransomware protection.

12

Common mistakes

  • Public buckets.

    Fix: Keep Block Public Access on; serve via CloudFront with origin access control.

  • Proxying uploads through app servers.

    Fix: Use pre-signed URLs for direct upload.

  • No versioning on critical data.

    Fix: Enable versioning and MFA delete or Object Lock.

13

Interview questions

How do you handle large file uploads?

Issue pre-signed URLs (multipart for large files) so clients upload directly to S3 in parallel parts, trigger processing from S3 events, and store metadata in a database.

How do you serve private files to authorized users?

Keep the bucket private and generate short-lived pre-signed GET URLs or CloudFront signed URLs/cookies after checking permissions.

14

Practice problems

ProblemDifficultyWhat it trains
Implement pre-signed uploadsEasySecurity.
Design Dropbox's storage layerHardChunking, dedupe, sync.