S3 vs EBS vs EFS: How to Choose the Right AWS Storage for Every Situation
S3, EBS, and EFS are three of AWS’s most commonly used storage services, and they come up together in almost every architecture discussion — including interviews. The confusion is understandable because on the surface they all store data. The reason AWS has three services instead of one is that object storage, block storage, and file storage solve fundamentally different problems.
The Core Distinction: How Data Is Addressed
The first thing to understand is how each service thinks about data:
S3 stores data as objects. Each object is a blob of bytes with a unique key (like a URL path). You cannot write to byte 500 of an existing object — you replace the whole object. Access is over HTTPS using the S3 API or pre-signed URLs. No instance is required.
EBS stores data as blocks. The operating system sees raw blocks and formats them with a filesystem. You can seek to any byte, write in place, and use it exactly like a local hard drive. Access requires an EC2 instance in the same AZ.
EFS stores data as files in a POSIX hierarchy. You create directories, move files, append to logs, and set Unix permissions just like a local filesystem. Multiple instances mount it concurrently using NFS.
Storage Abstraction Layers ==========================
S3 (Object) EBS (Block) EFS (File) ───────────────────── ───────────────────── ───────────────────── my-bucket/ /dev/xvdf /shared/ ├── reports/2025/ (raw blocks) ├── uploads/ │ └── q2.pdf OS formats │ └── photo.jpg └── images/ as ext4, xfs └── config/ └── logo.png or NTFS └── app.cfg
Access: HTTPS API Access: local device Access: NFS v4 Sharing: anyone with Sharing: one EC2 Sharing: many EC2 credentials instance at a time instances at onceWhen to Use Each Service
Use S3 when:
- Storing files that do not need a filesystem structure (backups, media, logs, datasets)
- Serving static web content — HTML, CSS, JS, images
- Building a data lake or feeding analytics services like Athena or EMR
- Storing data that Lambda, EC2, ECS, or any other service needs to read without being co-located
- Long-term archival where cost per GB matters more than access speed
Use EBS when:
- Running a database (MySQL, PostgreSQL, MongoDB, Oracle) on EC2
- The OS root disk for an EC2 instance
- Applications that need block-level access — write to specific byte offsets, use raw device access
- Single-instance workloads where you need the lowest possible latency
- Applications that require POSIX semantics but only one instance at a time
Use EFS when:
- Multiple EC2 instances need to read and write the same files simultaneously
- Web servers in an Auto Scaling group need to share uploaded content
- CI/CD build agents need a shared workspace
- Machine learning training nodes share a dataset across a cluster
- Content management systems where any server should see any file upload immediately
Side-by-Side Comparison
S3 vs EBS vs EFS — Key Dimensions ====================================
Dimension | S3 | EBS | EFS -----------------|-----------------|------------------|------------------ Storage type | Object | Block | File (NFS) Access method | HTTPS/API | OS block device | NFS mount Concurrent access| Unlimited | 1 instance* | Unlimited Latency | ~100ms (first) | <1ms | ~1-3ms Max size | Unlimited | 64 TiB/volume | Unlimited (elastic) Capacity mgmt | None needed | Provision size | None needed AZ scope | Regional (S3) | Single AZ | Regional OS support | Any | Linux & Windows | Linux only Pricing model | Per GB stored | Per GB provisioned| Per GB stored Typical cost | $0.023/GB | $0.08/GB (gp3) | $0.30/GB (Standard) Best for | Data lake, cdn | Databases, OS | Shared workspaces
* io2 Multi-Attach allows up to 16 instances but requires cluster-aware filesystemLatency Explained
The latency numbers above reflect the architectural differences. EBS runs over a dedicated high-speed network path between the instance and the storage layer, appearing to the OS as a local device. The result is sub-millisecond round-trip times for I/O operations — fast enough for any database.
EFS goes over NFS over the same VPC network. NFS adds protocol overhead, and the traffic competes with other network activity. Latency is typically 1-3ms for metadata operations and slightly less for data. This is fine for most applications but not for high-IOPS databases.
S3 is accessed over HTTPS. The first byte takes longer because of the TCP connection, TLS handshake, and request routing. Once the object starts downloading, throughput can be very high. S3 is not designed for random byte access or low-latency updates.
Cost Considerations
S3 is the cheapest per GB for stored data but charges for requests (PUT, GET) and data retrieval from archival classes. EBS charges for provisioned capacity whether you use it or not — a 500 GB gp3 volume costs the same whether it is 10% full or 95% full. EFS charges for stored data only (no provisioning), but the per-GB rate is higher than EBS or S3. EFS Infrequent Access drops the storage cost significantly for cold data.
Real-World Decision Scenario
A team is building a video platform with these components:
- User uploads raw video — stored in S3 (large files, access via presigned URL, feeds transcoding pipeline)
- Transcoding service runs on EC2 — needs fast scratch space during transcoding → EBS gp3
- Web tier serves the platform — 5 instances behind ALB, share uploaded thumbnails → EFS
- Completed video files for streaming → S3 (served via CloudFront)
- Video metadata database (PostgreSQL on EC2) → EBS io2 for IOPS consistency
All three services in use at once, each doing what it is actually designed for.
Key Interview Points
- S3 does not require an EC2 instance — data is accessed directly via the API from anywhere
- EBS volumes cannot be in a different AZ from the EC2 instance they attach to
- EFS supports only Linux; for Windows shared storage, use FSx for Windows File Server
- The phrase “shared storage for multiple EC2 instances” in an exam or interview question almost always points to EFS, not EBS
- S3 strong consistency: since December 2020, S3 provides strong read-after-write consistency — this often appears as a trick question
- EBS snapshots are incremental and stored in S3 (managed, not visible in your bucket), making cross-AZ volume migration possible
- For serverless architectures (Lambda, ECS Fargate), S3 is the natural storage layer; EFS can be mounted by Lambda functions when shared mutable storage is needed