EBS & EFS
EBS (Elastic Block Store) provides persistent block storage volumes for EC2 instances — like a hard drive attached to a single instance. EFS (Elastic File System) is a managed NFS file system that can be mounted by multiple EC2 instances simultaneously.
EBS is a USB drive — plugs into one computer at a time. EFS is a shared network drive — everyone in the office can access it simultaneously. Instance Store is RAM — blindingly fast but gone when you power off.
EBS volume types: gp3 (general purpose SSD, baseline 3,000 IOPS, independently configurable), io2 Block Express (highest performance, sub-millisecond latency, 256,000 IOPS — for databases), st1 (throughput-optimized HDD, sequential workloads), sc1 (cold HDD, cheapest, archives). EBS volumes are AZ-specific — to move, take a snapshot and restore in another AZ. EFS scales automatically, supports concurrent access from thousands of instances, and spans AZs within a region. EFS Infrequent Access storage class reduces cost for files not accessed recently.
EBS Multi-Attach allows io1/io2 volumes to be attached to multiple EC2 instances simultaneously within the same AZ — requires a cluster-aware filesystem (GFS2, not ext4) to prevent data corruption. EBS snapshots are incremental and stored in S3 (managed by AWS). EBS-optimized instances provide dedicated bandwidth to EBS, preventing network contention. EFS performance modes: General Purpose (latency-sensitive) and Max I/O (highly parallelized workloads). EFS throughput modes: Bursting (proportional to storage), Provisioned (independent of storage), and Elastic (auto-scales throughput). Instance store (ephemeral) provides the highest I/O performance but data is lost on stop/terminate — ideal for temp files, caches, and scratch data.
EBS is attached to one instance, like a local disk. I use gp3 for most workloads and io2 for latency-sensitive databases. EFS is a shared NFS file system for multi-instance access — content management systems, shared config, machine learning datasets. For highest I/O, instance store (ephemeral) is fastest but non-persistent. I snapshot EBS volumes regularly for backup and cross-AZ migration.
Attaching a standard EBS volume to multiple instances. Only io1/io2 support Multi-Attach, and you still need a cluster-aware filesystem. Using ext4 with Multi-Attach causes data corruption.