AWS TL;DR: EFS File System
Back to AWS TL;DR Hub

AWS EFS File System

/tldr: Elastic, scalable, serverless, and regional NFS storage for multiple EC2s.

File Storage NFS Protocol Multi-AZ

1. Core Concepts: The Shared Drive

EFS is built on the **NFSv4 protocol** and acts like a network-attached drive that can be concurrently mounted by **hundreds of EC2 instances** (or other services like ECS, Lambda, EKS).

Elastic & Serverless

  • **Elastic:** EFS scales automatically. You don't provision capacity; it grows and shrinks as files are added or removed.
  • **Pay-Per-Use:** You only pay for the storage you actually use, measured in GB-months.
  • **High Availability:** EFS is a **regional service** (unlike EBS). It stores data redundantly across multiple Availability Zones.

Accessing EFS: Mount Targets

To access the file system, you must create **Mount Targets**.

  • **AZ Specific:** You must create at least one Mount Target per AZ where your EC2 instances reside.
  • **Networking:** Mount Targets are IP addresses within your VPC and Security Groups control access to them (port 2049 for NFS).
  • **Cross-AZ:** Once mounted, the file system is accessible to EC2 instances in any AZ where a Mount Target exists.
# Mount command example on Linux EC2
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-xxxx.efs.region.amazonaws.com:/ /mnt/efs
                    

2. Performance Modes

EFS offers two modes to optimize for different workloads:

General Purpose (GP)

Best for most file system workloads: web serving, CMS, general data.

  • Optimized for low-latency performance.
  • Suitable for applications sensitive to file operation latency.

Max I/O

Best for high-throughput, highly parallel applications: big data analytics, media processing.

  • Can scale to higher levels of aggregate throughput.
  • May exhibit higher latency than General Purpose mode.

3. Storage Classes & Lifecycle Management

EFS automatically manages two classes, moving data to the cheaper, less-frequently-accessed tier using Lifecycle Management.

EFS Standard

  • **Primary Class:** For frequently accessed files requiring the lowest possible latency.
  • **Replication:** Data is replicated across multiple AZs within the region.

EFS Infrequent Access (EFS-IA)

  • **Cost Saving:** Significantly lower cost (up to 92% less) than Standard.
  • **Retrieval Charge:** You pay a small charge when files are retrieved/accessed.
  • **Lifecycle Policy:** Files not accessed for a set period (e.g., 30 days) are automatically moved from EFS Standard to EFS-IA. They automatically move back to Standard upon access.

One Zone Storage Classes

For **lower cost, non-critical workloads**, EFS also offers One Zone Standard and One Zone-IA classes. These sacrifice multi-AZ redundancy for cost savings.

EFS gives you the shared, dynamic storage you need for web fleets and data processing.

AWS Fundamentals Series: EFS