Volume 5 · Chapter 2 — Storage and Databases
Block and File Storage: EBS and EFS
2.1 Introduction
S3 is object storage, but not every workload wants objects over an API - some need a disk attached to a server, or a shared filesystem multiple servers can mount. AWS provides EBS for block storage and EFS for file storage, and knowing the difference between object, block, and file storage - and when each fits - is a foundational interview topic. This chapter covers EBS and EFS and situates them against S3 so you can pick the right storage type for a given need.
2.2 The Three Storage Types
There are three fundamental storage paradigms. Object storage (S3) stores whole objects addressed by key, accessed over an API - ideal for large-scale, durable data like backups and content, but not something a program mounts as a disk. Block storage (EBS) presents raw block volumes that attach to a single instance and behave like a hard drive - the operating system formats and uses them for filesystems and databases. File storage (EFS) presents a shared filesystem that many instances can mount simultaneously, with standard file semantics. The distinction matters because each suits different needs: object for scalable durable data, block for a single server’s disk (including databases), file for shared access across many servers.
flowchart TB
subgraph Object[S3 - Object storage]
O[API access, unlimited, durable\nbackups, content, data lakes]
end
subgraph Block[EBS - Block storage]
B[Attaches to ONE instance as a disk\nOS filesystems, databases]
end
subgraph File[EFS - File storage]
F[Shared filesystem MANY instances mount\nshared app data]
end 2.3 EBS: Block Storage
EBS (Elastic Block Store) provides durable, network-attached block volumes that attach to a single EC2 instance and act as its disk. The data persists independently of the instance lifecycle, so it survives the instance stopping (unlike ephemeral instance store). Volumes come in types trading performance and cost - SSD-backed for general and high-IOPS transactional workloads, HDD-backed for throughput-oriented and cheaper storage. Key operational features: you can snapshot a volume to S3 for backup and restore or clone from it, resize volumes, and encrypt them with KMS. EBS is what you use when a workload needs a fast, durable disk attached to one server - a database on EC2, or an application needing local block storage - and its snapshots are a core part of backup and recovery.
2.4 EFS: Shared File Storage
EFS (Elastic File System) provides a managed, elastic filesystem that multiple instances can mount and access concurrently, growing and shrinking automatically as you add or remove data. Unlike an EBS volume, which attaches to a single instance, EFS is shared - many servers, potentially across Availability Zones, read and write the same filesystem. This suits workloads where several instances need shared file access: shared application content, a common data directory, or a lift-and-shift application expecting a shared filesystem. It trades some performance and cost characteristics for that shared, elastic convenience. The decision between EBS and EFS often comes down to one question: does a single instance need a fast disk (EBS), or do many instances need to share files (EFS)?
2.5 Choosing Among S3, EBS, and EFS
The choice follows the access pattern. Use S3 for durable, scalable data accessed over an API - backups, documents, logs, static content, data lakes, and anything huge or archival; it’s the default for application data that isn’t a live disk. Use EBS when a single instance needs a persistent, high-performance block disk - most commonly a self-managed database or an application needing local storage. Use EFS when multiple instances must share the same filesystem concurrently. A common mistake is defaulting to a disk (EBS/EFS) for data that belongs in S3, or trying to share an EBS volume across instances (it attaches to one). The senior instinct is to match storage type to the access pattern: object over API, single-instance block disk, or shared file access.
2.6 Banking Production Scenario
A bank uses all three appropriately. Customer statements, backups, and compliance archives live in S3 - durable, cheap at scale, lifecycle-tiered. A legacy application it runs on EC2 keeps its working data on encrypted EBS volumes that are snapshotted nightly to S3 for backup and can be restored or cloned for recovery and testing. A shared content directory that several application instances must read and write concurrently sits on EFS, mounted across instances in multiple AZs. Everything is encrypted with KMS. By matching each need to the right storage type - object for durable data, block for the single-server disk, file for shared access - the bank gets appropriate performance, durability, and cost for each workload.
2.7 Troubleshooting: Storage Type Problems
Storage issues often stem from a mismatched type. Trying to share one EBS volume across multiple instances fails because EBS attaches to a single instance - the fix is EFS for shared access. Data lost after an instance stopped means it was on ephemeral instance store, not durable EBS. A database on EC2 that’s slow on I/O may need a higher-performance EBS volume type or more provisioned IOPS. Runaway storage cost for data that’s rarely accessed usually means it should be in S3 with lifecycle tiering rather than sitting on expensive block volumes. Lost data with no recovery path means snapshots or versioning weren’t in place. The diagnostic question is whether the storage type matches the access pattern - single-instance disk (EBS), shared filesystem (EFS), or durable API-accessed data (S3) - and whether backups (EBS snapshots, S3 versioning) exist.
Explain the difference between object, block, and file storage on AWS, and when to use each.
Object, block, and file storage are three fundamentally different storage paradigms, and AWS offers a service for each: S3, EBS, and EFS respectively. Object storage, provided by S3, stores whole objects - a file plus its metadata - addressed by a key and accessed over an API rather than mounted as a disk. It’s extremely durable, scales without limit, and is ideal for large-scale data like backups, documents, logs, static content, and data lakes - but it’s not something a program uses as a local disk or filesystem. Block storage, provided by EBS, presents raw block volumes that attach to a single EC2 instance and behave exactly like a hard drive: the operating system formats and uses them for filesystems and databases. EBS volumes are durable and persist independently of the instance’s lifecycle, come in performance tiers, and can be snapshotted and encrypted - you use block storage when a single server needs a fast, persistent disk, most commonly for a self-managed database or an application needing local block storage. File storage, provided by EFS, presents a shared filesystem that many instances can mount and access concurrently with standard file semantics, and it grows and shrinks elastically. The defining difference from EBS is sharing: an EBS volume attaches to one instance, whereas EFS is a shared filesystem multiple instances - even across Availability Zones - read and write at the same time. You use file storage when several instances must share the same files: shared application content, a common data directory, or a lift-and-shift app expecting a shared filesystem. So the decision follows the access pattern. If the data is durable, large-scale, or archival and accessed over an API - backups, records, content, analytics data - use S3. If a single instance needs a persistent high-performance disk - a database on EC2, local application storage - use EBS. If multiple instances need to share one filesystem concurrently, use EFS. The common mistakes are defaulting to an attached disk for data that belongs in cheaper, more durable S3, or trying to share a single EBS volume across instances, which doesn’t work because EBS is single-instance. Matching the storage type to whether you need object-over-API, a single-server block disk, or shared file access is exactly the judgment the question is testing.
Chapter Revision Notes
- Three paradigms: object (S3, API access, durable/unlimited), block (EBS, single-instance disk), file (EFS, shared filesystem).
- EBS attaches to one instance as a persistent disk; snapshot to S3 for backup, resize, encrypt with KMS - for databases and local storage.
- EFS is a shared, elastic filesystem many instances mount concurrently across AZs - for shared application data.
- Choose by access pattern: durable API data (S3), single-server disk (EBS), shared files (EFS).
- Common mistakes: putting disk-priced data that belongs in S3 on EBS, or trying to share one EBS volume across instances.