SkillSprout
Chapter 6 · Lesson 3
Intermediate
7 min read

EFS

Overview

Amazon Elastic File System (EFS) is a fully managed, elastic, shared file system for Linux workloads. It speaks the NFS (v4.0 and v4.1) protocol, so hundreds or thousands of EC2 instances, containers and Lambda functions can mount the same file system at the same time and see the same files.

EFS grows and shrinks automatically as you add and remove files: there is no capacity to provision and you pay only for what you use. By default it stores data redundantly across multiple Availability Zones in a Region, so a single AZ failure does not take your data offline.

Use EFS when you need a shared POSIX file system: content management systems, web server fleets sharing media, developer home directories, machine-learning datasets and container persistent storage on ECS and EKS. It is not for Windows (use FSx for Windows File Server) and is more expensive per GB than EBS or S3.

Key Concepts

  • EFS is regional, multi-AZ, NFS-based and Linux only (POSIX permissions); it is not supported on Windows instances.
  • Pay per GB used and storage scales automatically to petabytes, with no provisioning.
  • Access through one mount target per AZ (an ENI in a subnet) protected by a security group allowing TCP 2049 (NFS).
  • Performance modes: General Purpose (default, lowest latency) and Max I/O (legacy, higher aggregate throughput and latency).
  • Throughput modes: Elastic (recommended, automatic), Provisioned, and Bursting (scales with storage size).
  • Storage classes: Standard, Standard-IA, One Zone, One Zone-IA and Archive; lifecycle management moves cold files automatically.
  • Encryption at rest with KMS (choose at creation) and in transit with TLS via the amazon-efs-utils mount helper.
  • Backups with AWS Backup, replication to another Region, and access points to enforce per-application paths and POSIX identity.

Detailed Notes

How EFS works

An EFS file system is mounted by clients through mount targets. You create one mount target per AZ you use; each gets an IP address in your chosen subnet. Instances in the AZ talk to the local mount target using the NFS protocol, so there is no cross-AZ latency for connection setup. Clients in other VPCs, other accounts or on-premises can connect over VPC peering, Transit Gateway, VPN or Direct Connect.

bash
sudo yum install -y amazon-efs-utils
sudo mkdir /mnt/efs
# TLS-encrypted mount using the EFS mount helper
sudo mount -t efs -o tls fs-0123456789abcdef0:/ /mnt/efs
# Persistent mount in /etc/fstab
echo "fs-0123456789abcdef0:/ /mnt/efs efs _netdev,tls 0 0" | sudo tee -a /etc/fstab

Performance and throughput modes

SettingOptionsGuidance
Performance modeGeneral PurposeDefault; web serving, CMS, home directories; lowest latency
Max I/OLegacy; highly parallel big-data jobs with 1000s of clients; higher latency
Throughput modeElasticScales automatically; best for spiky or unpredictable workloads
ProvisionedFixed throughput independent of size; known steady need
BurstingBaseline proportional to size, bursts with credits

Performance mode is chosen at creation and cannot be changed; throughput mode can be changed later (with a cool-down period).

Storage classes and lifecycle

ClassRedundancyNotes
StandardMulti-AZFrequently accessed files
Standard-IAMulti-AZLower storage price, per-GB access fee
One ZoneSingle AZAbout 47% cheaper than Standard; dev/test, re-creatable data
One Zone-IASingle AZCheapest infrequent-access option
ArchiveMulti-AZRarely accessed data, lowest storage cost

Lifecycle management moves files that have not been accessed for a chosen period (1 to 365 days) to IA or Archive, and Intelligent-Tiering can move them back to Standard on first access. Files smaller than 128 KiB are not tiered.

Security

  • Network: security groups on the mount targets (inbound TCP 2049 from client SGs).
  • Identity: IAM authorization and file system policies (for example, enforce TLS or deny anonymous access) plus POSIX user/group permissions.
  • Access points are application-specific entry points that force a root directory and user identity - ideal for Lambda and multi-tenant containers.
  • Encryption at rest must be enabled when the file system is created; encryption in transit is optional per mount.

EFS vs EBS vs S3 vs FSx

EBSEFSS3FSx
TypeBlockFile (NFS)ObjectFile (SMB, Lustre, NFS, ZFS)
ScopeOne AZMulti-AZ, RegionalRegionalSingle or Multi-AZ
Shared accessOne instance (Multi-Attach io2 exception)Thousands of clientsHTTP APIMany clients
CapacityProvisionedElasticUnlimitedProvisioned
OSAnyLinux onlyAnyWindows, Linux

Operations and data protection

  • AWS Backup provides automatic daily backups by default; EFS Replication keeps a read-only copy in another Region or AZ with an RPO of minutes.
  • AWS DataSync migrates data between on-premises NFS/SMB and EFS; AWS Transfer Family exposes EFS over SFTP.
  • Monitor with CloudWatch metrics such as PercentIOLimit, BurstCreditBalance and ClientConnections.
  • For Lambda, EFS gives functions persistent shared storage beyond the 10 GB /tmp limit.

Real World Example

Scenario — a digital agency hosts 200 WordPress sites on an auto-scaling web fleet.

Each site stores user uploads, themes and plugins. When the Auto Scaling group had its own EBS volumes, an upload handled by one instance was invisible to the others, and scale-out instances started with stale content.

The agency creates an EFS file system with Elastic throughput, encryption and lifecycle management that moves files untouched for 30 days to Standard-IA, saving about 60% on media storage. A mount target is created in each of three AZs, and the wp-content directory is mounted on every instance through /etc/fstab. The shared content stays consistent no matter which instance serves the request, new instances join in seconds, and an AZ failure does not lose data. AWS Backup takes daily backups retained for 35 days.

Architecture Diagram

EFS shared by a multi-AZ web fleet
Architecture
AWS Cloud
Users
Application Load Balancer
Region
VPC
AZ A
Private subnet
Web server
Mount targetNFS 2049
AZ B
Private subnet
Web server
Mount targetNFS 2049
EFS file systemStandard + IA, encrypted
AWS Backupdaily

One mount target per AZ gives every instance access to the same NFS file system.

  1. 1Users reach the load balancer, which spreads requests across web servers in several AZs.
  2. 2Each server mounts the same EFS file system through the mount target in its own AZ over NFS on port 2049.
  3. 3Files written by one server are immediately visible to all others, so scaling in or out never loses content.
  4. 4Lifecycle management moves cold files to Standard-IA, and AWS Backup protects the file system.

Best Practices

  • ✓Use Elastic throughput and General Purpose performance mode unless you have measured a need for something else.
  • ✓Create a mount target in every AZ you run clients in and mount using the EFS mount helper with TLS.
  • ✓Enable lifecycle management (and Intelligent-Tiering) to move cold data to IA or Archive automatically.
  • ✓Allow only NFS (TCP 2049) from client security groups to mount targets; do not open it to wide CIDRs.
  • ✓Use access points and file system policies for multi-tenant, Lambda and container workloads instead of giving root access.
  • ✓Choose One Zone storage classes only for dev/test or re-creatable data; keep production on multi-AZ Standard classes.
  • ✓Enable AWS Backup and, for DR, EFS Replication to a second Region.
  • ✓Enable encryption at rest at creation time, as it cannot be added later to an existing file system.

Common Interview Questions

Exam Tips

SAA-C03 focus

  • "Shared file storage for Linux instances across multiple AZs" -> EFS. "Shared storage for Windows / SMB / Active Directory" -> FSx for Windows File Server.
  • EFS = NFS, POSIX, Linux only, elastic (no provisioning), multi-AZ by default, pay per GB used.
  • Cost optimisation: EFS Standard-IA / lifecycle management (rarely accessed) and One Zone (non-critical) are the usual answers.
  • Performance mode (General Purpose vs Max I/O) is fixed at creation; throughput mode (Elastic / Provisioned / Bursting) can be changed.
  • Security group on the mount target must allow TCP 2049. Encryption at rest is chosen at creation; in transit uses TLS through the mount helper.
  • EBS is one AZ, one instance; EFS is many instances, many AZs. EBS Multi-Attach is not a replacement for EFS across AZs.
  • On-premises servers can mount EFS over Direct Connect or VPN; DataSync moves data into EFS.

Finished this lesson?

0 of 64 lessons done · 0% of the course