Overview
Cloud storage comes in three main types. Block storage (EBS, persistent disks) provides raw volumes attached to one VM, used for databases and file systems. File storage (EFS, Filestore) provides shared network file systems mounted by many machines. Object storage (S3, GCS, Azure Blob) stores immutable objects with metadata in flat buckets, accessed over HTTP, at massive scale and low cost.
Each type trades latency, sharing, scalability, and cost. Storage tiers (hot, infrequent access, archive) let you move older data to cheaper storage automatically. Durability, replication, backups, and encryption are part of every storage design.
Block storage is your laptop's hard drive: fast and private. File storage is the office shared drive: everyone can open the same folders. Object storage is a vast warehouse where each box has a label; you fetch whole boxes by label.
When to use it
- Choosing where to store database files, uploads, logs, and backups.
- Designing data lakes and media storage.
- Sharing files between servers.
- Cost optimization for large, aging datasets.
Where it shows up in interviews
Recognize it when: store user uploads, images, videos.
- Design Instagram photo storage
- Design YouTube video storage
Recognize it when: keep data for years cheaply.
- Design log retention
- Design a backup system
Where it is used in real software
Companies store petabytes in S3 in Parquet and query them with Athena, Spark, or Snowflake.
Self-managed databases on EC2 use gp3 or io2 volumes for predictable IOPS.
Stores compliance archives for about $1 per TB per month with hours-long retrieval.
Key terms
- Block storage
- Raw volumes; low latency; attached to one instance.
- File storage
- Shared POSIX file system over the network.
- Object storage
- Objects with keys and metadata over HTTP; virtually unlimited.
- IOPS / throughput
- Operations per second / MB per second.
- Storage class / lifecycle
- Cost tier / rules that move or delete data over time.
How it works, step by step
- 1Classify the data
Database files, shared files, blobs, backups, logs.
- 2Pick the type
Block for databases, file for shared access, object for blobs and lakes.
- 3Pick performance
IOPS and throughput for block; request rates for object.
- 4Set durability and backups
Snapshots, versioning, cross-region replication.
- 5Set lifecycle rules
Move cold data to cheaper tiers; expire old data.
Block vs file vs object
Storage types compared
| Aspect | Block (EBS) | File (EFS) | Object (S3) |
|---|---|---|---|
| Access | One instance (mostly) | Many instances | Anyone via HTTP API |
| Latency | Sub-millisecond | Milliseconds | Tens of milliseconds |
| Scale | Up to tens of TB per volume | Petabytes | Unlimited |
| Cost (relative) | Medium | Highest | Lowest |
| Typical use | Databases, boot disks | Shared content, legacy apps | Uploads, backups, data lakes |
NOWAspect: Access | Block (EBS): One instance (mostly) | File (EFS): Many instances | Object (S3): Anyone via HTTP API
Store blobs in object storage and metadata in a database; never store large files inside the database.
Implementation
{ "Rules": [ { "ID": "logs-tiering", "Filter": { "Prefix": "logs/" }, "Status": "Enabled", "Transitions": [ { "Days": 30, "StorageClass": "STANDARD_IA" }, { "Days": 90, "StorageClass": "GLACIER_IR" }, { "Days": 365, "StorageClass": "DEEP_ARCHIVE" } ], "Expiration": { "Days": 2555 } } ]}Complexity and performance
Multipart upload above 100 MB.
Scales with prefixes.
Trade-offs
Block storage is fastest but limited and expensive; object storage is slower per request but cheap and unlimited.
Very cheap storage but retrieval takes minutes to hours and has fees.
Variants and related techniques
Ephemeral local NVMe disks: very fast, lost on stop.
HDFS, Ceph, and Lustre for big data and HPC.
Common mistakes
- Storing images as database BLOBs.
Fix: Put them in object storage and store the key in the DB.
- No backups for block volumes.
Fix: Schedule snapshots and test restores.
Interview questions
Where do you store user-uploaded photos?
In object storage (S3) with metadata (owner, key, size) in a database, uploaded directly by clients with pre-signed URLs, served through a CDN, and tiered with lifecycle rules.
When do you use block storage instead of object storage?
When you need low-latency random reads and writes with a file system, such as database data files or boot volumes attached to a VM.
Practice problems
| Problem | Difficulty | What it trains |
|---|---|---|
| Choose storage for 6 data types | Easy | Types. |
| Design storage for 1 PB of video | Medium | Tiering and CDN. |