EBS, EFS & Instance Storage
Block and file storage on AWS — EBS volume types (gp3, io2, st1, sc1), IOPS vs throughput, snapshots and AMIs, encryption, Multi-Attach, instance store, EFS shared NFS file systems and their performance modes, FSx, and choosing between block, file and object storage.
Not everything fits S3's object model. Databases need a disk with low-latency random reads and writes; legacy apps and shared content need a file system. AWS provides both (File systems, I/O and disks).
| EBS (block) | Instance store (block) | EFS (file) | S3 (object) | |
|---|---|---|---|---|
| Attach to | One instance (Multi-Attach for io1/io2 only) | The host it's on | Thousands of instances, Lambda, containers | Anything over HTTPS |
| Scope | One AZ | One host | Region (multi-AZ) or One Zone | Region |
| Persistence | Independent of instance | Lost on stop/terminate | Persistent | Persistent |
| Latency | Sub-millisecond | Lowest (local NVMe) | Low milliseconds | Tens of milliseconds |
| Use | Boot volumes, databases | Caches, scratch, replicated data stores | Shared files, CMS, home directories | Everything else |
EBS: Elastic Block Store
An EBS volume is a network-attached virtual disk, replicated within its AZ. It can only attach to instances in the same AZ; move data across AZs via snapshots.
Volume types
| Type | Media | Performance | Use |
|---|---|---|---|
| gp3 (general purpose SSD) | SSD | Baseline 3,000 IOPS and 125 MB/s regardless of size; provision more independently | The default for almost everything |
| gp2 | SSD | IOPS scale with size (3 per GB), burst credits | Legacy — migrate to gp3, usually cheaper |
| io2 Block Express | SSD | Up to 256,000 IOPS, sub-millisecond, 99.999% durability | Large, latency-critical databases |
| st1 (throughput HDD) | HDD | High sequential throughput | Big data, log processing |
| sc1 (cold HDD) | HDD | Lowest cost | Rarely accessed sequential data |
IOPS vs throughput: IOPS counts operations per second (what random small I/O like database pages needs); throughput is MB per second (what sequential scans need). Both can be the bottleneck — and the instance type also has its own EBS bandwidth limit, so a huge volume on a small instance won't reach its rated performance.
Snapshots
- Incremental point-in-time backups stored in S3 (managed by AWS): only changed blocks are stored after the first.
- Copy across regions and accounts for disaster recovery; create AMIs from them.
- Automate with Data Lifecycle Manager or AWS Backup (central policies, retention, vault lock).
- A volume restored from a snapshot loads blocks lazily on first access — the first read of each block is slow. Use fast snapshot restore or read the volume once to initialise it before putting it into service.
- For databases, crash-consistent snapshots are usually fine for engines with a write-ahead log, but flush or freeze the file system for application-consistent backups (Transactions and ACID).
Other features
- Encryption with KMS — enable encryption by default per region; it covers data at rest, snapshots and data in transit to the instance with negligible performance cost.
- Elastic Volumes: grow size, change type or provisioned IOPS while the volume is in use (then extend the file system).
- Multi-Attach (io1/io2): attach one volume to up to 16 Nitro instances in the same AZ — only with a cluster-aware file system, or you will corrupt data.
Instance store
Physically attached NVMe on the host: the fastest storage available and included in the instance price, but ephemeral. Good for caches, buffers, scratch space, and databases that replicate across nodes anyway (Cassandra, Kafka, or a ClickHouse cluster with replicas).
EFS: Elastic File System
A managed NFS file system that many clients mount at once — EC2 instances in any AZ, ECS and EKS containers, Lambda functions:
sudo mount -t efs -o tls fs-0abc123:/ /mnt/shared- Elastic: grows and shrinks automatically; pay for what you store.
- Throughput modes: Elastic (default, scales with workload, pay per use), Provisioned, or Bursting.
- Storage classes: Standard and Infrequent Access/Archive with lifecycle management.
- Regional (multi-AZ) or One Zone for lower cost.
- Access points enforce a root directory and POSIX user per application.
EFS latency is higher than EBS, and metadata-heavy workloads (millions of small files, git operations, npm install) can be slow. It's excellent for shared content, ML datasets read by many workers, and lift-and-shift apps that expect a shared disk.
FSx
FSx offers managed third-party file systems when NFS isn't the right fit: FSx for Windows File Server (SMB, Active Directory), FSx for Lustre (high-performance computing and ML training, linked to S3), FSx for NetApp ONTAP and FSx for OpenZFS.
Choosing storage
- Can the application use an object API? → S3 — cheapest, most durable, unlimited (S3).
- Needs a disk for one instance (database, boot volume)? → EBS gp3, io2 if latency-critical.
- Needs a shared POSIX file system? → EFS (Linux) or FSx (Windows, HPC).
- Needs maximum speed for temporary or replicated data? → instance store.
- Better still: use a managed database (RDS and Aurora, DynamoDB) instead of running one on EBS yourself.
QWhat's the difference between EBS and EFS?easy
EBS is block storage: a virtual disk attached to a single EC2 instance in one availability zone, with low latency, suitable for boot volumes and databases. EFS is a managed NFS file system that many instances, containers and Lambda functions across multiple AZs can mount simultaneously, growing automatically. EBS is lower latency and cheaper per GB for a single server; EFS is for shared file access.
QHow do you move an EBS volume to another availability zone or region?medium
Take a snapshot, which is stored regionally, then create a new volume from it in the target AZ. For another region, copy the snapshot to that region first (re-encrypting with a key there if needed), then create the volume. Plan for lazy loading after restore: use fast snapshot restore or pre-read the volume before production use.
QA database on EC2 is slow on disk I/O. What do you check?hard
Compare the workload's IOPS and throughput (CloudWatch VolumeReadOps, VolumeWriteOps, throughput and queue length) with the volume's provisioned limits — gp2 volumes may have exhausted burst credits, and gp3 may need more IOPS or throughput provisioned. Check the instance type's EBS bandwidth limit, which can cap performance below the volume's. Check whether the volume was recently restored from a snapshot and is still lazy-loading. Then consider io2 for latency, more memory so the working set is cached, or a managed database service.
- EBS is network block storage in one AZ; gp3 is the default, io2 for demanding databases, HDD types for sequential throughput.
- Performance depends on IOPS, throughput and the instance's EBS bandwidth.
- Snapshots are incremental, regional and copyable; restored volumes lazy-load blocks.
- Instance store is the fastest but ephemeral.
- EFS is a shared, elastic NFS file system across AZs; FSx covers Windows, Lustre, ONTAP and OpenZFS.
- Prefer S3 or a managed database where possible; use block and file storage when the software requires it.