EBS vs EFS vs instance store
The three storage options for EC2 side by side, with the rules that decide between them in exam questions.
The three options
EC2 instances can store data in three places. Exam questions often describe a need and ask which one fits.
EBS volumes
- Attached to one instance at a time (except io1/io2 with Multi-Attach).
- Locked to one AZ. To move one to another AZ: take a snapshot, then restore it there.
- Performance: gp2 IOPS grow with size; gp3, io1 and io2 raise IOPS independently.
- Backups use I/O. Snapshots read the volume, so don't run them during heavy traffic.
- Root volumes are deleted when the instance terminates, by default (this can be turned off).
- Billed for provisioned size.
EFS
- Mounted by hundreds of instances across AZs at once.
- Linux only (POSIX).
- Shares website files (WordPress), home directories, application data.
- Higher price per GB than EBS, but billing is only for what's stored, and storage classes cut the cost of cold files.
Instance store
- Physical disks inside the host, for the instance that runs there.
- The highest IOPS and lowest latency.
- Ephemeral: data is lost on stop, hibernate, terminate or hardware failure.
- Included in the instance price.
Deciding in a question
- Boot disk, database on EC2, data must survive stop/start, one server → EBS.
- Several servers, possibly in different AZs, need the same files → EFS (Linux) or FSx (Windows and others).
- Temporary data, cache, highest performance, data can be rebuilt → instance store.
- Need the same data in another AZ → EBS snapshot and restore; or use EFS, which is already in every AZ.
Exam tips
- "Shared across AZs" rules out EBS and instance store.
- "Survives instance stop" rules out instance store.
- "Lowest cost per GB for one server's disk" → EBS (gp3, or st1/sc1 for throughput data), not EFS.
- "Millions of IOPS on one instance" → instance store.
Check yourself
Amazon EFS, mounted by every web server through the mount target in its AZ.
Instance store (storage optimized instances). The data is already replicated across nodes, so ephemeral disks are fine, and they give the highest IOPS.
An EBS gp3 volume with 10,000 provisioned IOPS (gp3 sets IOPS without buying a bigger disk).
Take a snapshot of the volume, then create a new volume from the snapshot in us-east-1c and attach it.