Understand EFS as shared multi-instance NFS storage. Compare EFS vs EBS, learn storage classes, and know when to choose each.
EFS — Shared File Storage for Multiple EC2 Instances
EFS provides a shared NFS file system that can be mounted simultaneously by multiple EC2 instances, ECS tasks, Lambda functions, and EKS pods. Unlike EBS (one volume, one instance), EFS scales automatically and is accessible to thousands of instances at once.
Teacher Note: EBS is like a USB drive — plugs into one computer at a time. EFS is like a network drive (NAS) in an office — multiple computers mount it simultaneously and all see the same files. Perfect for shared content like website assets, ML datasets, and application configuration files.
EFS vs EBS Comparison
| Feature | EFS | EBS |
|---|
| Access | Multiple instances simultaneously | One instance at a time (usually) |
| Protocol | NFS (Network File System) | Block storage (like a hard drive) |
| Scaling | Automatic — grows/shrinks with data | Manual — provision capacity upfront |
| AZ | Multi-AZ (regional service) | Single AZ (must snapshot to move) |
| Price | $0.30/GB/month | $0.08-0.10/GB/month (gp3) |
| Performance | Consistent (latency varies with load) | Consistent low latency |
| Best For | Shared content, CMS, ML datasets | OS disk, databases, high IOPS apps |
EFS Storage Classes
| Class | Description | Cost |
|---|
| Standard | Frequently accessed files | $0.30/GB/month |
| Infrequent Access (IA) | Files not accessed in 30+ days | $0.016/GB/month |
| Archive | Rarely accessed files | $0.008/GB/month |
# Mount EFS on Linux EC2
sudo apt install nfs-common # Install NFS client
# Mount
sudo mount -t nfs4
-o nfsvers=4.1,rsize=1048576,wsize=1048576
fs-12345678.efs.us-east-1.amazonaws.com:/
/mnt/efs
# Add to /etc/fstab for persistent mount
fs-12345678.efs.us-east-1.amazonaws.com:/ /mnt/efs nfs4 defaults 0 0
Exam Tip: EFS Intelligent Tiering automatically moves files between Standard and IA tiers based on access patterns — you get cost savings without managing lifecycle rules manually. Great for content management systems where some files are accessed daily and others are never touched after upload.