Stop 05 · Storage ServicesTopics · 3/9

File Storage (EFS)

Part of the Cloud Computing Roadmap

In short

Five web servers all need to read the same uploaded files. Block disks can't be shared like that, and object storage isn't a normal folder. File storage is the shared drive for servers.

Network file storage that can be mounted simultaneously by multiple VMs or containers — used when several compute resources need to share the same file system, unlike block storage's single-attachment model.

The blob character places a file on a big shared shelf in a staff room.

Think of it like this

The staff room shelf

Every teacher in the department uses the same staff room shelf. One teacher drops a question paper there and another picks it up a minute later. Nobody carries their own copy. A network file system is that shared shelf for your servers.

Watch it happen

Two servers, one folder

web-1
EFS (NFS)
web-2

mount /mnt/shared

1/5web-1 mounts the file system over NFS, like plugging into a shared network drive.

The big ideas

What you need to know

Shared by many

Many VMs, containers or functions can mount the same file system at once and see the same files.

Real folders

It's a normal POSIX file system with directories, permissions and file locks. Old apps work without changes.

Elastic size

EFS grows as you add files. You pay for what's stored, not for a fixed disk size.

Costs more per GB

File storage is pricier than object storage. Use it when apps truly need a shared filesystem, not for cheap bulk data.

See it in code

Walk through the code

bash
1# On Amazon Linux: install the EFS mount helper2sudo dnf install -y amazon-efs-utils3sudo mkdir -p /mnt/shared4 5# Mount with encryption in transit6sudo mount -t efs -o tls fs-0123456789abcdef0:/ /mnt/shared7df -h /mnt/shared8 9echo "hello from $(hostname)" | sudo tee /mnt/shared/hi.txt

1/3Install the helper and create a mount point.

Run the same mount on a second instance and you'll see hi.txt there too. The security group must allow NFS (port 2049) between them.

Save yourself the pain

Common mistakes

Oops

Using EFS to store terabytes of old logs.

Do this instead

That's object storage's job. Keep file storage for data that apps must open as files from several servers.

Oops

Forgetting the security group for port 2049.

Do this instead

The mount hangs if NFS traffic is blocked. Allow 2049 from your instances' security group to the EFS mount targets.

Your mission

Share a folder between two VMs

~40 min

Quick check

Four containers on different servers must read and write the same set of files as a normal folder. Which storage fits?

Go deeper

  1. 1Set up a shared file storage system and mount it on 2 VMs simultaneously.
  2. 2Learn when shared file storage is the right choice versus object or block storage.
  3. 3Understand the performance and cost trade-offs of file storage compared to the other two options.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge