DevOps Peach

AWS Basics · Storage on AWS – EBS, Instance Store, EFS, and S3 · Lesson 3 of 5

Instance Store, EBS, and EFS

Choose local storage, block storage, or shared NFS.

Practice interactively →

Three storage models

Instance Store resides on the EC2 host and offers very low-latency I/O, but it is ephemeral: data is lost on stop, hibernation, termination, or host failure. Use it only for caches, buffers, and reproducible scratch data, or for software that replicates data itself across nodes.

flowchart LR
  IS["Instance Store<br/>local NVMe, ephemeral"] --> E1["EC2 in AZ 1a"]
  EBS["EBS volume<br/>zonal block"] --> E1
  EFS["EFS file system<br/>regional NFS"] --> MT1["Mount target<br/>AZ 1a, TCP 2049"]
  EFS --> MT2["Mount target<br/>AZ 1b"]
  MT1 --> E1
  MT2 --> E2["EC2 in AZ 1b"]
  %% step IS: Instance store disks are physically on the host; fastest, but data disappears when the instance moves or stops.
  %% step EBS: An EBS volume is network storage for one instance in one AZ (except io2 Multi-Attach).
  %% step EFS: EFS is one shared file system for the whole Region.
  %% step MT1: Each AZ gets a mount target with an IP in your subnet; its SG must allow NFS on 2049.
  %% step MT2: Instances mount the target in their own AZ.
  %% step E2: Many instances in different AZs read and write the same files at once.

Comparing them

Instance Store EBS EFS S3
Type Block, local Block, network File (NFS v4) Object (HTTP API)
Scope One host One AZ Region (or One Zone) Region
Shared by many instances No No (io2 Multi-Attach aside) Yes, thousands Yes, via API
Survives stop No Yes Yes Yes
Billing Included in instance price Provisioned GB GB actually stored GB stored + requests
OS Any Any Linux (NFS clients) Any, via SDK/CLI

For Windows file shares, use Amazon FSx for Windows File Server instead of EFS.

EFS details

EBS is a zonal block device, commonly serving one instance. EFS is managed regional NFS for Linux clients, with mount targets in AZs and one filesystem shared by many instances. It grows and shrinks automatically; you never provision size.

An EFS mount often fails when the mount-target Security Group lacks inbound TCP 2049 from the client Security Group. Install amazon-efs-utils to get the efs mount type and helper.

Instance store use cases

Temporary data that can be rebuilt: build caches, video transcoding scratch space, the buffer of a distributed database like Cassandra that keeps replicas on other nodes. Never the only copy of anything.

Command Purpose
aws efs create-file-system --encrypted --tags Key=Name,Value=shared Create an EFS file system
aws efs create-mount-target --file-system-id fs-0a1b2c3d --subnet-id subnet-0a1b2c3d --security-groups sg-0a1b2c3d Add a mount target in a subnet
sudo mount -t efs -o tls fs-0a1b2c3d:/ /mnt/efs Mount EFS with TLS
df -h -t nfs4 Verify the mount

Traps: storing the only copy of data on instance store; forgetting port 2049 in the mount target's SG; choosing EFS for Windows servers.

Practice interactively →