EBS vs EFS: Differences, Performance and When to Use
EBS vs EFS on AWS: block vs NFS storage, volume types and IOPS, EFS throughput modes, Multi-Attach, backups and a scenario table to pick one.
Amazon EBS is block storage that you attach to an EC2 instance, like a local disk, and it lives in one Availability Zone. Amazon EFS is a managed NFS file system that many instances, containers and Lambda functions can mount at the same time, across Availability Zones. Choose EBS for databases and boot volumes, and EFS for shared files.
Key takeaways
- EBS gives one instance a fast, low-latency disk. EFS gives many compute resources one shared directory tree.
- EBS volumes are created in a single Availability Zone and attach to instances there. A regional EFS file system stores data across multiple Availability Zones.
- EFS speaks NFS (v4.1 and v4.0) and is not supported on Windows-based EC2 instances. EBS works with Linux and Windows.
- With EBS you provision size and, for some types, IOPS and throughput. EFS grows and shrinks automatically and defaults to Elastic throughput.
- Neither is a backup by itself. EBS needs snapshots, and EFS needs AWS Backup or replication.
- Some workloads need neither: object data usually belongs in S3, and a shared block volume needs a clustered file system.
The core difference in one table
| Question | Amazon EBS | Amazon EFS |
|---|---|---|
| Storage type | Block | File (NFS) |
| How you use it | Format with a file system (ext4, XFS, NTFS) and mount like a local disk | Mount over the network with NFS or the EFS mount helper |
| Who can use it | One instance at a time; Multi-Attach on io1 and io2 allows up to 16 Nitro instances in the same Availability Zone | Thousands of clients at once, including EC2, ECS, EKS, Lambda and Fargate |
| Availability Zone scope | One Availability Zone; data is replicated within it | Regional (multiple AZs, recommended) or One Zone |
| Capacity | You choose a size (1 GiB to 64 TiB for gp3 and io2) | No size to provision; scales to petabytes automatically |
| Operating systems | Linux and Windows | Linux. Windows-based EC2 instances are not supported |
| Boot volume | Yes (SSD types) | No |
| Backups | Snapshots (incremental, stored in S3) | AWS Backup or EFS Replication |
How EBS works
An EBS volume is a block device. After you attach it to an instance, you use it as you would a local hard drive: create a file system, mount it and store files or install applications. AWS replicates volume data across multiple servers inside the Availability Zone, so a single component failure does not lose data, but the volume is not spread across zones.
That zone scope has a practical effect. If the Availability Zone has an outage, the volume is affected. Snapshots solve this: they are stored in S3 and replicated across all Availability Zones in the Region, so you can restore a volume in any zone. AWS is explicit that it does not back up EBS volumes for you. You create snapshots yourself or automate them with Amazon Data Lifecycle Manager or AWS Backup.
EBS volume types
The EBS volume types page lists these figures. Check it for current limits, because AWS raises them over time.
| Type | Family | Size | Max IOPS | Max throughput | Typical use |
|---|---|---|---|---|---|
| gp3 | General Purpose SSD | 1 GiB to 64 TiB | 80,000 | 2,000 MiB/s | Boot volumes, most databases, dev and test |
| gp2 | General Purpose SSD (older) | 1 GiB to 16 TiB | 16,000 | 250 MiB/s | Legacy workloads; gp3 is recommended |
| io2 Block Express | Provisioned IOPS SSD | 4 GiB to 64 TiB | 256,000 | 4,000 MiB/s | Latency-sensitive, I/O-heavy databases |
| io1 | Provisioned IOPS SSD (older) | 4 GiB to 16 TiB | 64,000 | 1,000 MiB/s | Sustained IOPS above 16,000 |
| st1 | Throughput Optimized HDD | 125 GiB to 16 TiB | 500 | 500 MiB/s | Big data, log processing |
| sc1 | Cold HDD | 125 GiB to 16 TiB | 250 | 250 MiB/s | Infrequently accessed data at lowest cost |
The gp3 type is the default choice for most workloads. Every gp3 volume includes a baseline of 3,000 IOPS and 125 MiB/s at no extra charge, and you can provision more IOPS (up to 80,000) and throughput (up to 2,000 MiB/s) independently of size. AWS states that gp3 is priced 20 percent lower per GiB than gp2. In gp2, performance scales with size at 3 IOPS per GiB (minimum 100, maximum 16,000) and small volumes burst using I/O credits. Moving from gp2 to gp3 can be done online with Elastic Volumes:
aws ec2 modify-volume --volume-id vol-0123456789abcdef0 --volume-type gp3
Creating a gp3 volume with extra performance looks like this:
aws ec2 create-volume \
--availability-zone ap-south-1a \
--volume-type gp3 --size 200 \
--iops 6000 --throughput 250 \
--encrypted
Our runbooks cover the next steps: attaching and detaching EBS volumes and EBS encryption and snapshots.
EBS Multi-Attach
Multi-Attach lets you attach one io1 or io2 volume to multiple instances in the same Availability Zone (up to 16 Nitro-based instances). It does not turn EBS into a shared file system. AWS notes that standard file systems like XFS and ext4 are not designed for simultaneous access by multiple servers, so you must use a clustered file system or an application that manages write ordering. If you only need several servers to read and write the same files, EFS is simpler.
How EFS works
EFS is serverless, elastic file storage. You do not provision capacity or performance. It supports NFSv4.1 and NFSv4.0, POSIX permissions, file locking and strong data consistency, and it can be mounted from EC2, ECS, EKS, Lambda and Fargate. AWS notes that using EFS with Microsoft Windows-based EC2 instances is not supported.
There are two file system types. Regional file systems store data redundantly across multiple Availability Zones and are the recommended type. One Zone file systems keep data in a single zone, which costs less but means data may be lost if that zone is damaged.
EFS performance and throughput modes
EFS has two performance modes (General Purpose and Max I/O) and three throughput modes (Elastic, Provisioned and Bursting). AWS recommends General Purpose mode for all file systems because Max I/O has higher per-operation latency.
| Throughput mode | How it behaves | Pick it when |
|---|---|---|
| Elastic (default recommendation) | Scales up and down automatically; you pay for data read and written | Spiky or hard-to-predict workloads, or average-to-peak throughput of 5 percent or less |
| Provisioned | You set the throughput, independent of size | You know the requirement, or average-to-peak is 5 percent or more |
| Bursting | Baseline scales with stored data: 50 KiBps per GiB, bursting to 100 KiBps per GiB using credits | Throughput should grow with the amount of data stored |
AWS lists first-byte latencies for the Standard storage class as low as about 1 millisecond for reads and 2.7 milliseconds for writes, and tens of milliseconds for the Infrequent Access and Archive classes. Compare that with EBS io2 Block Express, designed for average latency under 500 microseconds for 16 KiB I/O. Network file access will not match a locally attached block volume for small, random I/O, so EFS is a poor fit for a busy transactional database.
Mounting EFS on Linux
With the amazon-efs-utils package installed, the mount helper makes it a short command. The tls option encrypts data in transit:
sudo mkdir -p /mnt/efs
sudo mount -t efs -o tls fs-abcd123456789ef0:/ /mnt/efs
Create a file system with encryption at rest, the recommended General Purpose mode and Elastic throughput:
aws efs create-file-system \
--performance-mode generalPurpose \
--throughput-mode elastic \
--encrypted
You then create mount targets in each subnet and allow NFS traffic (TCP 2049) from your clients in the mount target's security group. Instances need network access to a mount target, so check the VPC design if a mount hangs.
Which one should you use? Scenarios
| Scenario | Better choice | Reason |
|---|---|---|
| MySQL or PostgreSQL on a single EC2 instance | EBS (gp3, or io2 for heavy I/O) | Low-latency block access; one writer |
| Instance root volume | EBS | EFS cannot be a boot volume |
| WordPress or CMS media shared by several web servers | EFS | All servers need the same files in the same path |
| Home directories for a team of Linux users | EFS | Shared POSIX file system with permissions |
| Shared persistent storage for ECS or EKS tasks in different zones | EFS | A regional file system is reachable from every zone |
| Lambda function that needs a larger or shared file area | EFS | Lambda can mount EFS |
| Single-pod Kubernetes database | EBS-backed volume | Performance and single-writer semantics; see Kubernetes storage classes |
| Static assets, logs and backups at large scale | S3 (neither) | Object storage is cheaper and built for this |
| Windows file server workload | EBS on the instance, or a Windows-native file service | EFS does not support Windows-based EC2 instances |
Backup and recovery
Both services need a plan you have actually tested.
- EBS: snapshots are incremental, which means only changed blocks are saved after the first one. Deleting a snapshot might not reduce storage costs, because blocks referenced by other snapshots are kept. Automate with Data Lifecycle Manager or AWS Backup. See also our post on snapshots for EC2 backup and recovery.
- EFS: use AWS Backup and consider replication to another Region for disaster recovery. Our guide on EFS backup strategies goes through the options.
- Encryption: both support encryption at rest. EFS also supports encryption in transit at mount time. Compare with S3 in encryption in S3 vs EBS.
Cost and performance traps
- Leaving volumes on gp2 when gp3 is cheaper and gives a predictable baseline.
- Over-provisioning io2 IOPS you never use. Check CloudWatch volume metrics before you pay for more.
- Using EFS Bursting throughput for a small file system that needs steady throughput. Small file systems have a low baseline and can run out of burst credits. Elastic or Provisioned avoids this.
- Using EFS for many tiny files with chatty metadata operations. Test it, because per-operation latency adds up over a network.
- Forgetting that an EBS volume cannot follow an instance to another Availability Zone without a snapshot restore.
- Assuming that EFS throughput charges are fixed. With Elastic throughput you pay for the data you read and write, so set CloudWatch alerts.
Related learning
To see how storage fits next to compute and networking, read our guide on choosing an EC2 instance type. For Kubernetes storage, see Kubernetes storage classes. Our AWS Solutions Architect Associate course (classroom in Pune or live online) includes hands-on storage labs.
Frequently asked questions
What is the main difference between EBS and EFS?
EBS is block storage attached to one instance in one Availability Zone. EFS is a shared NFS file system that many clients across Availability Zones can mount at once.
Can multiple EC2 instances use the same EBS volume?
Only with Multi-Attach, which supports io1 and io2 volumes attached to up to 16 Nitro-based instances in the same Availability Zone. You also need a clustered file system or application-level write control.
Does EFS work with Windows?
AWS states that using EFS with Microsoft Windows-based Amazon EC2 instances is not supported. EFS is designed for Linux clients using NFS.
Which is faster, EBS or EFS?
For small random I/O and low latency, EBS is faster because it is block storage close to the instance. EFS suits shared, parallel access and larger sequential workloads where its network latency is acceptable.
Which EBS volume type should I choose?
Start with gp3 for most workloads. Use io2 Block Express when you need consistent sub-millisecond latency or more than 80,000 IOPS. Use st1 or sc1 for large, throughput-oriented data that is accessed sequentially.
Which EFS throughput mode should I choose?
AWS recommends Elastic for spiky or unpredictable workloads. Use Provisioned when you know the throughput you need, and Bursting when throughput should scale with how much data you store.
Are EBS and EFS data backed up automatically?
No. AWS says it is your responsibility to create EBS snapshots regularly or automate them. For EFS, set up AWS Backup or replication yourself.
Is EFS regional or zonal?
Both options exist. Regional file systems store data across multiple Availability Zones and are recommended. One Zone file systems keep data in one zone and risk data loss if that zone is lost.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0