- Published on
Amazon EFS Cheat Sheet
- Authors
- Name
- QuizCld
Amazon Elastic File System (EFS) Cheatsheet
What is Amazon EFS?
Amazon EFS (Elastic File System) is a fully-managed, serverless, elastic NFS file system service that makes it easy to set up, scale, and cost-optimize file storage in the AWS Cloud.
Key Features
- Fully-managed service: No file storage infrastructure to provision or manage
- NFS compatibility: Supports Network File System version 4 (NFSv4) protocol
- Elastic scaling: Automatically grows and shrinks as you add and remove files
- Multi-AZ redundancy: Data and metadata stored redundantly across multiple AZs
- Shared access: Allows thousands of concurrent NFS connections
- Petabyte scale: Can grow to petabyte scale with high throughput
- Linux & macOS support: Mount on EC2 instances running Linux or macOS Big Sur (Windows not supported)
- Integration with AWS services: Mount on ECS tasks, EKS pods, and Lambda functions
- Security: POSIX permissions and IAM-based access control
- Data consistency: Strong data consistency and file locking support
Storage Classes
Storage Class | Description | Use Case |
---|---|---|
Standard | Default storage class with highest performance | Active file workloads |
Infrequent Access (IA) | Lower cost storage for less frequently accessed files | Files accessed less than once per 30 days |
One Zone | Standard storage in a single AZ | Lower-cost option for easily reproducible data |
One Zone-IA | Infrequent access storage in a single AZ | Lowest cost option for infrequently accessed data |
Performance Modes
Mode | Description | Best For |
---|---|---|
General Purpose (default) | Lower latency, good for most workloads | Web serving, CMS, home directories |
Max I/O | Higher throughput and IOPS with slightly higher latency | Big data, media processing, scientific analysis |
Throughput Modes
Mode | Description | Best For |
---|---|---|
Bursting (default) | Throughput scales with file system size | Varied or unpredictable workloads |
Provisioned | Specify throughput independent of storage size | Predictable performance requirements |
Elastic | Automatically scales throughput up or down | Applications with variable performance needs |
Access Points
- Simplify application access to shared datasets
- Enforce operating system user, group, and directory for every request
- Work with IAM for granular access control
- Provide isolated application-specific view of the file system
Mounting EFS File Systems
Prerequisites:
# Install EFS client on Amazon Linux or Amazon Linux 2
sudo yum install -y amazon-efs-utils
# Install on Ubuntu/Debian
sudo apt-get -y install git binutils
git clone https://github.com/aws/efs-utils
cd efs-utils
./build-deb.sh
sudo apt-get -y install ./build/amazon-efs-utils*deb
Mount Commands:
# Basic mount using EFS mount helper
sudo mount -t efs fs-12345678:/ /mnt/efs
# Mount with encryption in transit
sudo mount -t efs -o tls fs-12345678:/ /mnt/efs
# Mount via DNS name
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-12345678.efs.us-east-1.amazonaws.com:/ /mnt/efs
# Mount using Access Point
sudo mount -t efs -o tls,accesspoint=fsap-12345678 fs-12345678:/ /mnt/efs
Automount with fstab:
# Add to /etc/fstab
fs-12345678:/ /mnt/efs efs defaults,tls 0 0
Security Best Practices
- Enable encryption at rest and in transit
- Use IAM roles for EC2 instances accessing EFS
- Configure NFS client firewall rules
- Use security groups to control network access
- Apply principle of least privilege with Access Points
- Set proper POSIX permissions on files and directories
- Enable AWS CloudTrail to audit API calls
Monitoring and Management
CloudWatch Metrics:
- BurstCreditBalance: Available burst credits
- PermittedThroughput: Allowed throughput in MiB/s
- TotalIOBytes: I/O operations in bytes
- DataWriteIOBytes: Write operations in bytes
- DataReadIOBytes: Read operations in bytes
- MeteredIOBytes: Billable I/O operations in bytes
- StorageBytes: Size of file system by storage class
Data Migration and Backup:
- Use AWS DataSync for efficient data transfer between on-premises and EFS
- Use EFS-to-EFS backup solution for scheduled incremental backups
- AWS Backup integrates with EFS for automated backups
- Configure Lifecycle Management to move infrequently accessed files to IA storage class
Pricing Considerations
- Pay only for storage used (no pre-provisioning)
- Standard storage: Higher cost, best performance
- IA storage: Up to 85% lower cost for infrequently accessed files
- One Zone storage: Lower cost by storing in a single AZ
- Throughput pricing based on mode selected
- Cost savings through appropriate lifecycle management policies
When to Use EFS vs Alternative Services
EFS vs EBS:
- Choose EFS when you need shared access from multiple instances across AZs
- Choose EBS for single-instance access with lowest latency requirements
EFS vs S3:
- Choose EFS for file system access semantics and hierarchical structure
- Choose S3 for object storage with web-scale access patterns
Common Use Cases
- Content Management Systems
- Web Serving
- Application Development Environments
- Database Backups
- Media Processing Workflows
- Big Data and Analytics
- Home Directories
- Container Storage
- Machine Learning Training