EBS, instance store, EFS & FSx
Pick block or file storage based on performance, sharing and OS needs.
By Invicly Tech, , in AWS Solutions Architect – Associate. About 13 minutes to read.
In short
EBS volumes are network block disks for one EC2 instance in one AZ, while instance store is fast local disk that disappears on stop. EFS is a managed NFS file system shared by many Linux clients across AZs. FSx offers managed Windows, Lustre, NetApp ONTAP and OpenZFS file systems.
Explained simply
Servers need disks, and EC2 offers two kinds. An EBS volume (Elastic Block Store) is a network disk: it lives on separate storage hardware in the same Availability Zone and keeps its data when you stop the instance. Instance store is a disk physically inside the host computer: very fast, but its data is gone when the instance stops.
Block storage is a raw disk. The operating system formats it with a file system like ext4, XFS or NTFS, and normally only one machine uses it. File storage is a ready-made shared folder on the network. Many machines can open the same files at the same time, like a shared drive in an office.
On AWS, EFS (Elastic File System) is the shared folder for Linux machines, using the NFS protocol. FSx is a family of managed file systems for special needs: Windows file shares, very fast Lustre for high-performance computing, and NetApp ONTAP or OpenZFS for teams moving those systems from their own data center.
Picking storage comes down to a few questions. Does one machine need the data, or many? Linux or Windows? Must the data survive a stop? How many reads and writes per second, and how large are they? Answer those, and the right service is usually obvious.
Press Play on a diagram to walk through it one step at a time.
- Block storage, one AZ
- Persists after stop
- Snapshots to S3
- gp3, io2, st1, sc1 types
- Physically attached disk
- Highest IOPS, low latency
- Lost on stop or failure
- Caches, buffers, scratch
- NFS file system
- Thousands of Linux clients
- Multi-AZ, grows automatically
- IA tiers via lifecycle
- Linux NFS
- Amazon EFS
- Windows SMB
- FSx for Windows File Server
- Active Directory integration
- HPC and ML
- FSx for Lustre
- Links to S3 data
- Multi-protocol or migration
- FSx for NetApp ONTAP
- FSx for OpenZFS
- 1Application
Writes a file, for example a database page
- 2File system
ext4 or XFS turns files into blocks
- 3Block device
Shows up as /dev/nvme1n1 on Nitro instances
- 4Nitro card
Sends block I/O over the AWS network
- 5EBS storage servers
Data replicated inside the same AZ
- Raw disk the OS formats
- Usually one instance
- Lowest latency
- Boot disks and databases
- Shared folder over NFS or SMB
- Many clients at once
- File locks and permissions
- Home folders, shared content
- Whole objects over HTTPS
- Practically unlimited scale
- No in-place edits
- Data lakes, backups, media
In depth
EBS volume types by the numbers
SSD volumes are rated in IOPS (input/output operations per second) and HDD volumes in throughput (MB per second). gp3 is the default: every gp3 volume gets a baseline of 3,000 IOPS and 125 MB/s at any size, and you can buy extra IOPS and throughput separately from capacity. The older gp2 ties speed to size, 3 IOPS per GiB with burst credits for small volumes, which is why moving from gp2 to gp3 is usually cheaper and faster.
io2 Block Express is for demanding databases: up to 256,000 IOPS per volume, sub-millisecond latency and 99.999 percent durability. st1 (throughput-optimized HDD) suits big sequential reads such as logs and data pipelines, and sc1 (cold HDD) is the cheapest for rarely read data. Neither HDD type can be a boot volume. The instance also has its own EBS bandwidth limit, so a small instance can bottleneck a fast volume.
- Default SSD for most apps
- 3,000 IOPS baseline at any size
- Buy more IOPS and MB/s separately
- Critical, busy databases
- Up to 256,000 IOPS
- Multi-Attach within one AZ
- HDD, rated in MB/s
- st1: big sequential reads
- sc1: coldest and cheapest
- Cannot be boot volumes
Snapshots, encryption and moving volumes
An EBS snapshot is a point-in-time backup that AWS stores in S3 for you (it does not appear in your buckets). The first snapshot copies all used blocks; later ones copy only changed blocks, yet each snapshot can still restore the whole volume. You can copy snapshots to other Regions or share them with other accounts, which is how you move a volume to another AZ or Region.
Encryption uses KMS and is invisible to the instance. You cannot encrypt an existing unencrypted volume in place: snapshot it, copy the snapshot with encryption on, and create a new volume from the copy. Turn on EBS encryption by default in each Region to avoid the problem. A volume created from a snapshot loads its blocks from S3 lazily, so the first read of each block is slow; Fast Snapshot Restore removes that delay for an extra fee.
- 1Snapshot the volume
Point-in-time copy of all blocks
- 2Copy with encryption
copy-snapshot --encrypted, pick a KMS key
- 3Create a new volume
From the encrypted copy, in any AZ
- 4Swap the volumes
Stop, detach old, attach new
- 5Start and verify
Then delete the old volume
Instance store: when losing data is fine
Instance store disks are NVMe SSDs (or HDDs on some types) inside the host, so they give very high IOPS and low latency at no extra charge; the cost is included in instance types such as i4i, d3, or sizes with a d in the name like m6id. Data survives a reboot but is lost when the instance stops, hibernates or terminates, or when the host fails. You cannot detach an instance store disk or snapshot it.
Good uses are caches, buffers, scratch files, and data that is already copied elsewhere, such as nodes of a replicated database like Cassandra, or Kafka brokers with replication turned on. If the data matters and exists only on that disk, it does not belong there.
EFS in practice
EFS is a managed NFS file system (NFS versions 4.0 and 4.1) for Linux. You create mount targets, one per AZ, each with an IP address in your subnet and a security group that must allow TCP port 2049 from your clients. Many EC2 instances, containers and Lambda functions can mount it at once, and it grows and shrinks automatically, so you pay only for the data stored.
Lifecycle management moves files that nobody has read for a set time to the Infrequent Access and Archive storage classes, which cost much less per GB. For throughput, Elastic mode is the recommended default and scales with demand; Provisioned mode fixes a level you pay for. EFS One Zone keeps data in one AZ for a lower price. EFS does not work with Windows, and each operation is slower than on EBS, so it is a poor home for a busy database.
Choosing an FSx flavour
FSx for Windows File Server gives real Windows shares over SMB, joined to Active Directory (AWS Managed Microsoft AD or your own), with NTFS permissions, shadow copies and DFS namespaces. Use Multi-AZ for production. FSx for Lustre is a parallel file system for HPC, machine learning and video rendering, with sub-millisecond latency and very high total throughput. It can link to an S3 bucket, showing objects as files and writing results back. Scratch deployments are cheap and temporary; persistent ones keep data safe for long-running work.
FSx for NetApp ONTAP serves NFS, SMB and iSCSI at the same time and offers ONTAP features like SnapMirror, which makes it the easy target when you migrate from an on-premises NetApp. FSx for OpenZFS gives fast NFS with snapshots and clones, a natural home for ZFS or Linux file servers.
Learn it in 4 short steps
About 45m each. Track them with a timer in your plan.
- 1Compare EBS volume types~45m
- 2Know when instance store fits~45m
- 3Share files with EFS~45m
- 4Choose FSx for Windows or Lustre~45m
Key points
- gp3 is the default general-purpose SSD with IOPS set independently of size.
- io2 Block Express gives the highest IOPS and supports Multi-Attach.
- st1 and sc1 HDD volumes cannot be boot volumes.
- To move an EBS volume to another AZ, snapshot it and restore there.
Key terms
Tap a card to flip it. 0/5 known
Examples
Move a gp2 volume to gp3 without downtime
A 100 GiB gp2 volume gives only 300 IOPS baseline and is filling up. With Elastic Volumes you can change type, size and performance while the instance runs. Step 1: modify the volume to gp3 at 200 GiB with 4,000 IOPS and 250 MB/s. Step 2: watch the modification state; the volume is usable the whole time. Step 3: grow the partition and file system so the OS sees the new space. After a change you must wait 6 hours before modifying the same volume again.
# Change type, size and speed live (no detach, no reboot)
aws ec2 modify-volume --volume-id vol-0abc1234def567890 \
--volume-type gp3 --size 200 --iops 4000 --throughput 250
# Progress: modifying -> optimizing -> completed
aws ec2 describe-volumes-modifications --volume-ids vol-0abc1234def567890 \
--query 'VolumesModifications[0].ModificationState'
# Inside the instance: grow partition 1, then the file system
sudo growpart /dev/nvme0n1 1
sudo xfs_growfs -d / # for ext4: sudo resize2fs /dev/nvme0n1p1A shared uploads folder for a web fleet
Web servers in an Auto Scaling group across two AZs must all see the same user uploads. Step 1: create an EFS file system with a mount target in each AZ. Step 2: give the mount targets a security group that allows TCP 2049 from the web servers' security group. Step 3: on each server (or in the launch template user data), install amazon-efs-utils, mount with TLS, and add an fstab line so the mount comes back after a reboot.
# On each web server (Amazon Linux 2023)
sudo dnf install -y amazon-efs-utils
sudo mkdir -p /var/www/uploads
sudo mount -t efs -o tls fs-0123456789abcdef0:/ /var/www/uploads
# Mount again automatically after a reboot
echo 'fs-0123456789abcdef0:/ /var/www/uploads efs _netdev,tls 0 0' | sudo tee -a /etc/fstab
df -h /var/www/uploadsQuick reference
- gp3 baseline: 3,000 IOPS and 125 MB/s at any size; buy more separately
- gp2 to gp3: aws ec2 modify-volume --volume-type gp3 works while the instance runs
- io2 Block Express: up to 256,000 IOPS; Multi-Attach to up to 16 Nitro instances in one AZ
- st1 and sc1 are HDD volumes and cannot be boot volumes
- Instance store survives a reboot; lost on stop, hibernate, terminate or host failure
- EFS: Linux only, NFS on TCP 2049, one mount target per AZ
- Windows shares with AD: FSx for Windows File Server. HPC on S3 data: FSx for Lustre
- Encrypt an existing volume: snapshot, copy with encryption, create a new volume
Common mistakes
- Choosing EFS for Windows servers; Windows needs FSx for Windows File Server.
- Storing irreplaceable data only on instance store.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Create a 20 GiB gp3 volume in the same AZ as one of your instances, attach it, format it with XFS and mount it at /data.
- Exercise 2medium
Snapshot a volume, copy the snapshot to eu-west-1 with encryption, and create a gp3 volume from it there.
- Exercise 3hard
Benchmark a gp3 volume at its default settings with fio, raise it to 6,000 IOPS, and show the change with a second run.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Can I attach one EBS volume to two instances?
- Normally no. Only io1 and io2 volumes support Multi-Attach, within one AZ, and the app must use a cluster-aware file system to avoid corrupting data. For simple shared files, use EFS or FSx.
- Is EFS more expensive than EBS?
- Per GB stored, EFS Standard costs more than gp3. But you pay only for what you store instead of a provisioned size, and lifecycle tiers to Infrequent Access cut the price a lot for cold files.
- Does a reboot erase instance store data?
- No. A reboot keeps instance store data. A stop, hibernate, terminate or hardware failure erases it.
- Can Windows servers use EFS?
- No. EFS supports Linux NFS clients only. Use FSx for Windows File Server for SMB shares.