Skip to main content

04. Amazon EFS

Amazon EFS (Elastic File System) is a fully managed, scalable, shared network file system (NFS) that can be mounted simultaneously on hundreds of Linux EC2 instances even across multiple Availability Zones (AZs).

It provides shared file access, automatic scaling, and high availability, making it ideal for workloads where multiple instances need access to the same data at the same time.


FeatureDescription
TypeManaged Network File System (NFS)
AccessibilityMount on 100s of EC2 instances(Linux Only)
PersistenceData remains even if EC2 stops/terminates
AZ ScopeMulti-AZ, highly available
Use CasesWeb servers, CMS, shared storage, container workloads
CostPay per use, no capacity planning

⚙️ How It Works

EFS is mounted over the network using the NFSv4 protocol.
Each EC2 instance connects to an EFS Mount Target within its Availability Zone.

You can think of it as a shared drive that multiple Linux instances can read/write to concurrently.

💡 Each AZ connects through its mount target, ensuring high performance and redundancy.


🔁 Comparison: EBS vs EFS

FeatureEBS (Elastic Block Store)EFS (Elastic File System)
AttachmentOne instance per AZMany instances across AZs
ScopeSingle AZMulti-AZ
PerformanceHighScalable, elastic throughput
DurabilityPersistentPersistent
ProtocolBlock storageNFS (file system)
Use CaseDatabases, single-instance appsShared content, multi-instance workloads


💡 EFS Storage Classes

EFS offers two main storage classes:

Storage ClassDescriptionCostIdeal Use
EFS StandardFrequently accessed files💰 HigherActive workloads
EFS Infrequent Access (EFS-IA)Files not accessed often💸 Up to 92% cheaperArchival / cold data

🔄 Lifecycle Management

EFS can automatically move files between these two storage classes based on access patterns.

Example:

  • You define a Lifecycle Policy: move files to EFS-IA after 60 days of no access.
  • If the file is accessed again → EFS automatically brings it back to EFS Standard.

This transition is automatic and transparent to your applications —
your code doesn’t need to change or know where the file resides.

AWS diagram

🧠 Use Cases

ScenarioWhy EFS Fits
Web server farmsMultiple EC2s share same web content
Content Management Systems (CMS)Centralized file storage across many nodes
Big Data / AnalyticsShared access to large datasets
Container workloads (ECS / EKS)Persistent shared volumes for containers
Machine Learning trainingDistributed data sharing among nodes

⚠️ Limitations

  • ❌ Works only with Linux EC2 instances (not Windows)
  • 💸 More expensive than EBS (approx. 3× gp2 pricing)
  • 📡 Requires network connectivity (since it’s NFS-based)

🧾 Summary

FeatureEBSInstance StoreEFS
Storage TypeNetwork-attached blockLocal hardware diskNetwork file system (NFS)
PersistencePersistentEphemeralPersistent
Multi-AZ Access❌ No❌ No✅ Yes
Shared Access❌ One instance❌ No✅ Many instances
CostModerateFree (included)High (pay per GB used)
Ideal UseDatabases, OS disksCaching, temp dataShared storage for multiple EC2s

🧠 Key Exam Tip

Whenever you see:

“Shared file system accessible by multiple Linux EC2 instances across AZs”

➡️ Think Amazon EFS.