In the world of cloud infrastructure, choosing the right storage solution is crucial. If you're working with AWS and wondering whether EFS or EBS is the right tool for your workload, you’re in the right place.
In this article, we'll break down:
- What Amazon Elastic File System (EFS) is
- How to create and mount an EFS
- The difference between EFS and Amazon EBS
- When to use each one
What is Amazon EFS?
Amazon Elastic File System (EFS) is a fully managed, serverless, elastic file storage system that you can mount across multiple EC2 instances via the NFS (Network File System) protocol.
Think of it as a shared drive in the cloud that multiple virtual machines can use at the same time perfect for applications that need access to the same data concurrently.
Key Features of EFS:
- Elastic: Automatically scales as you add/remove files
- Fully Managed: No servers to provision or manage
- Shared Access: Mountable to multiple EC2s concurrently
- Secure: Supports encryption at rest and in transit
- Highly Available: Data is stored across multiple AZs (Availability Zones)
How to Create and Use Amazon EFS
Step 1: Create an EFS File System
- Go to the EFS Dashboard.
- Click “Create file system”.
- Give it a name and select the VPC where your EC2 instances live.
- Use default settings for availability and performance unless you have special needs.
from the image it automatic connect to the instance i created through the VPC
- Click “Create” — AWS handles the provisioning.
Step 2:
Create Two EC2 Instances
Launch 2 Amazon Linux 2023 instances:
Both in same VPC and subnet
Choose t2.micro for free tier
Enable public IP and SSH access
Step 3: Install NFS Utilities on EC2
SSH into your EC2 instance(s) and run:
sudo yum install -y nfs-utils # Amazon Linux / RHEL
Step 4: Mount the EFS File System
Use the efs-id from your file system (or use the DNS name AWS provides):
sudo mkdir /mnt/efs
sudo mount -t nfs4 -o nfsvers=4.1 fs-12345678.efs.us-east1.amazonaws.com:/ /mnt/efs
✅ You’re now using a shared file system across EC2s!
EFS vs. EBS: What's the Difference?
Feature | Amazon EFS | Amazon EBS |
---|---|---|
Storage Type | File system (NFS) | Block storage |
Access | Multiple EC2 instances (shared) | One EC2 instance at a time (unless using Multi-Attach with limits) |
Use Case | Web servers, CMS, shared config | Databases, OS storage, low-latency apps |
Elasticity | Auto-scales storage | Must specify volume size |
Backup | Lifecycle policies, AWS Backup | Snapshots, AWS Backup |
Throughput | Scales with size & throughput mode | Defined by volume type (gp3, io1, etc.) |
Mount Protocol | NFS (Network File System) | Appears as a raw block device |
Top comments (0)