Block, file and object: EBS, instance store, EFS and when each fits
AWS has three storage shapes, and picking the wrong one is a design bug that shows up later as an outage or a bill. Block storage (EBS, instance store) is a disk for one instance. File storage (EFS, FSx) is a shared file system many instances mount at once. Object storage (S3) is an HTTP API for whole objects at any scale. AWS III grew an EBS volume; this lesson puts the three side by side and mounts an EFS file system on two instances in two AZs.
Need to know: an EBS volume lives in one AZ and attaches to one instance (io2 Multi-Attach aside); snapshots go to S3 and can be restored in any AZ. Instance store disks are physically attached and lost when the instance stops. EFS is NFS v4.1, regional (data in several AZs), elastic in size, mounted through a mount target per AZ (port 2049, security groups), with access points for per-application views and lifecycle policies that move cold files to cheaper classes.
The three shapes
| EBS | instance store | EFS | S3 | |
|---|---|---|---|---|
| shape | block (a disk) | block | file (NFS) | object (HTTP) |
| shared? | one instance | one instance | thousands of clients | any client |
| scope | one AZ | the host | Region (or One Zone) | Region |
| survives stop? | yes | no | yes | yes |
| grows | modify-volume | no | by itself | by itself |
| typical | boot disks, databases | caches, scratch, buffers | shared uploads, home dirs, CMS | backups, assets, data lakes |
FSx adds managed file systems with other protocols: FSx for Windows File Server (SMB, AD), FSx for Lustre (HPC, linked to S3), FSx for NetApp ONTAP and OpenZFS. EFS is the Linux default.
An EFS file system, from the API
$ aws efs describe-file-systems --query 'FileSystems[?Name==`shop-uploads`].{id: FileSystemId, state: LifeCycleState, mode: PerformanceMode, throughput: ThroughputMode, encrypted: Encrypted, size: SizeInBytes.Value}'
[
{
"id": "fs-76585636963748398",
"state": "available",
"mode": "generalPurpose",
"throughput": "elastic",
"encrypted": true,
"size": 4096
}
]
$ FS=$(aws efs describe-file-systems --query 'FileSystems[?Name==`shop-uploads`].FileSystemId' --output text)
$ aws efs describe-mount-targets --file-system-id $FS --query 'MountTargets[].[MountTargetId,AvailabilityZoneName,IpAddress,LifeCycleState]' --output text
fsmt-15477d31887f6b151 eu-central-1a 10.30.10.67 available
fsmt-1b6829153a1868451 eu-central-1b 10.30.11.56 available
$ aws efs describe-mount-target-security-groups --mount-target-id $(aws efs describe-mount-targets --file-system-id $FS --query 'MountTargets[0].MountTargetId' --output text)
{
"SecurityGroups": [
"sg-0017e216c35063843"
]
}
One mount target per AZ, each an ENI with an address in a private subnet and a security group. That group must allow TCP 2049 from the clients: the most common EFS problem is a mount that hangs and then fails with Connection timed out because it does not. Elastic throughput (the default now) scales with the workload and bills per GB transferred. Bursting and provisioned are the older modes.
Mount it on two instances in two AZs
$ echo $FS
fs-76585636963748398
$ aws ssm start-session --target $(aws ec2 describe-instances --filters Name=tag:Name,Values=app-1 Name=instance-state-name,Values=running --query 'Reservations[0].Instances[0].InstanceId' --output text)
Starting session with SessionId: learner-01403a097e3540e4f
$ sudo mkdir -p /mnt/uploads
$ sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-76585636963748398.efs.eu-central-1.amazonaws.com:/ /mnt/uploads
$ df -h /mnt/uploads
Filesystem Size Used Avail Use% Mounted on
fs-76585636963748398.efs.eu-central-1.amazonaws.com:/ 8.0E 4.0K 8.0E 1% /mnt/uploads
$ echo 'product 4711 photo' | sudo tee /mnt/uploads/4711.jpg
product 4711 photo
$ exit
Exiting session with sessionId: learner-01403a097e3540e4f.
$ aws ssm start-session --target $(aws ec2 describe-instances --filters Name=tag:Name,Values=app-2 Name=instance-state-name,Values=running --query 'Reservations[0].Instances[0].InstanceId' --output text)
Starting session with SessionId: learner-025f0818175918bb3
$ sudo mkdir -p /mnt/uploads && sudo mount -t nfs4 -o nfsvers=4.1,hard,noresvport fs-76585636963748398.efs.eu-central-1.amazonaws.com:/ /mnt/uploads
$ cat /mnt/uploads/4711.jpg
product 4711 photo
$ exit
Exiting session with sessionId: learner-025f0818175918bb3.
The DNS name <fs-id>.efs.<region>.amazonaws.com resolves, inside the VPC, to the mount target in the client's own AZ. That avoids cross-AZ traffic and keeps working if another AZ fails. df shows 8.0E: EFS has no fixed size and you pay for what is stored. The options are AWS's recommended ones (hard so writes are not silently dropped, noresvport so a reconnect after a network event uses a new port). The amazon-efs-utils helper (mount -t efs fs-id:/ /mnt) adds TLS in transit (-o tls) and IAM authorization. For a permanent mount, add the line to /etc/fstab with _netdev,nofail, so a boot does not hang when the network or EFS is not there.
Access points and lifecycle
$ aws efs create-access-point --file-system-id $FS --posix-user Uid=1001,Gid=1001 --root-directory 'Path=/thumbnails,CreationInfo={OwnerUid=1001,OwnerGid=1001,Permissions=750}' --tags Key=Name,Value=try-thumbnails --query '[AccessPointId,RootDirectory.Path,PosixUser]' --output json
[
"fsap-0412214847364950a",
"/thumbnails",
{
"Uid": 1001,
"Gid": 1001
}
]
$ aws efs put-lifecycle-configuration --file-system-id $FS --lifecycle-policies TransitionToIA=AFTER_30_DAYS TransitionToArchive=AFTER_90_DAYS TransitionToPrimaryStorageClass=AFTER_1_ACCESS
{
"LifecyclePolicies": [
{
"TransitionToIA": "AFTER_30_DAYS"
},
{
"TransitionToArchive": "AFTER_90_DAYS"
},
{
"TransitionToPrimaryStorageClass": "AFTER_1_ACCESS"
}
]
}
$ aws efs describe-file-systems --file-system-id $FS --query 'FileSystems[0].SizeInBytes'
{
"Value": 8192,
"Timestamp": "2026-09-22T19:00:04.000000+00:00",
"ValueInIA": 0,
"ValueInStandard": 8192,
"ValueInArchive": 0
}
- An access point gives one application its own view: a root directory (created with an owner and mode on first use) and a forced POSIX user and group, whatever the client claims. Together with an EFS file system policy (
elasticfilesystem:ClientMount,ClientWrite,aws:SecureTransport) that is how several teams share one file system safely. EKS and ECS mount through access points. - Lifecycle: files not read for 30 days move to Infrequent Access, after 90 to Archive, and back to Standard on the next access. Reads from IA and Archive cost per GB, so this fits data that is mostly cold.
SizeInBytesshows what sits in each class. - One Zone file systems keep data in one AZ for about half the price. They suit dev and data you can rebuild, not data that must survive an AZ outage.
- Backups:
put-backup-policy --backup-policy Status=ENABLEDputs the file system in AWS Backup's default plan (daily, 35 days). EFS replication copies it to another Region.
On the exam (SOA-C03 1.3, SAA-C03 3.1, CLF-C02 3.6): "shared file system for Linux instances across AZs" = EFS; "Windows / SMB" = FSx for Windows File Server; "HPC, high throughput, S3 integration" = FSx for Lustre; "temporary, fastest local disk, data can be lost" = instance store; "boot volume / database on one instance" = EBS (gp3, io2 for guaranteed IOPS). "Lower EFS cost for rarely read files" = lifecycle to IA / Archive. "Mount hangs" = the mount target security group and port 2049.
In an interview: "EFS or EBS for a database?" - "EBS. A database wants a block device with low, predictable latency on one host, and replicates at the database level (or RDS does it). EFS fits files that many hosts share: uploads, shared configuration, home directories, build caches. NFS latency and locking semantics are a poor fit for a database's data files."
You can now: choose between EBS, instance store, EFS, FSx and S3 by access pattern and durability, read an EFS file system's mount targets and their security groups, mount it on instances in two AZs with the recommended options, and use access points and lifecycle policies.