DEV Community

Cover image for πŸ“… Day 17 | AWS EFS (Elastic File System) β€” Shared Storage in AWS πŸ—‚οΈβ˜οΈ
Sudarshan Yadav
Sudarshan Yadav

Posted on

πŸ“… Day 17 | AWS EFS (Elastic File System) β€” Shared Storage in AWS πŸ—‚οΈβ˜οΈ

πŸ“… Day 17 | AWS EFS (Elastic File System) β€” Shared Storage in AWS πŸ—‚οΈβ˜οΈ

Today, I learned about Amazon EFS (Elastic File System), which is a fully managed, scalable, shared file system in AWS.

EFS allows multiple EC2 instances to read and write data simultaneously, making it ideal for DevOps and cloud-native architectures.

EFS helps in building highly available, scalable, and persistent storage solutions for applications running across multiple Availability Zones.


πŸ—‚οΈ AWS EFS (DevOps – Shared File System)

πŸ”Ή Amazon EFS (Elastic File System)

Service Type

  • File-based storage service
  • Uses NFS protocol (Port 2049)

Key Features

  • Shared storage across multiple EC2 instances
  • Automatically scales storage
  • Highly available (Multi-AZ)
  • Fully managed by AWS
  • Linux-based file system

Common DevOps Use Cases

  • Jenkins shared workspace
  • Kubernetes Persistent Volumes (PV/PVC)
  • Web application shared uploads
  • Centralized logs storage
  • WordPress media storage

One-Line Summary (Interview)

Amazon EFS is a fully managed shared file system that provides scalable and highly available storage for multiple EC2 instances across availability zones using NFS.

AWS EFS (Elastic File System) – Step by Step DevOps Guide

This guide explains Amazon EFS in a simple, fresher-friendly DevOps way, ready to upload on GitHub (Markdown format).


1️⃣ What is AWS EFS?

Amazon EFS (Elastic File System) is a fully managed, scalable, shared file system provided by AWS.

πŸ‘‰ Think of EFS like Google Drive for EC2 instances β€” multiple EC2 instances can read and write the same data at the same time.


2️⃣ Why We Use EFS in DevOps

EFS is used when we need:

  • βœ… Shared storage between multiple EC2 instances
  • βœ… Persistent data (data survives EC2 termination)
  • βœ… High availability (multi-AZ)
  • βœ… Linux-based file system (NFS)

3️⃣ Real-World DevOps Use Cases

Use Case Why EFS
Web application uploads Same files for all EC2
Jenkins shared workspace Multiple Jenkins agents
Kubernetes persistent storage Shared PVC
Centralized logs Common log directory
WordPress media Shared media files

4️⃣ How EFS Works (Architecture)

User
 ↓
Load Balancer
 ↓
EC2 (AZ-1) ─┐
EC2 (AZ-2) ─┼──> EFS (Shared File System)
EC2 (AZ-3) β”€β”˜
Enter fullscreen mode Exit fullscreen mode
  • EFS is regional
  • Uses NFS protocol (Port 2049)
  • Mounted like a folder inside EC2

5️⃣ EBS vs EFS vs S3 (Interview Comparison)

Feature EBS EFS S3
Storage Type Block File Object
Attach Single EC2 Multiple EC2 Internet
OS Support Linux/Windows Linux only Any
Mountable Yes Yes No
Shared Access ❌ βœ… βœ…

6️⃣ Step-by-Step: How to Create and Use EFS

πŸ”Ή Step 1: Create EFS

  1. AWS Console β†’ EFS
  2. Click Create file system
  3. Select VPC
  4. Availability Zones β†’ Auto selected
  5. Click Create

πŸ”Ή Step 2: Configure Security Group

EFS needs NFS access.

Inbound Rule:

Type: NFS
Port: 2049
Source: EC2 Security Group
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 3: Launch EC2 Instance

  • Amazon Linux 2
  • Same VPC as EFS
  • Attach same Security Group
  • SSH into the instance

πŸ”Ή Step 4: Install EFS Utilities

sudo yum install -y amazon-efs-utils
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 5: Create Mount Directory

sudo mkdir /efs
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 6: Mount EFS to EC2

sudo mount -t efs fs-xxxx:/ /efs
Enter fullscreen mode Exit fullscreen mode

Check mount:

df -h
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 7: Test Shared Storage

cd /efs
sudo touch devops.txt
Enter fullscreen mode Exit fullscreen mode

Mount the same EFS on another EC2 β†’ file will be visible βœ…


7️⃣ Auto-Mount EFS on Reboot (Important)

Edit fstab file:

sudo nano /etc/fstab
Enter fullscreen mode Exit fullscreen mode

Add entry:

fs-xxxx:/ /efs efs defaults,_netdev 0 0
Enter fullscreen mode Exit fullscreen mode

8️⃣ EFS Performance Modes

Mode Usage
General Purpose Web apps, CMS
Max I/O Big data, analytics

9️⃣ EFS Storage Classes

Class Cost
Standard Normal access
Infrequent Access (IA) Lower cost
One Zone Cheapest (single AZ)

πŸ”Ÿ EFS Usage in DevOps Tools

Tool Usage
Jenkins Shared workspace
Docker Shared volume
Kubernetes Persistent Volumes
Terraform Infrastructure creation
Ansible Auto mount configuration

1️⃣1️⃣ Common Interview Questions

Q1: Can EFS be mounted on multiple EC2 instances?
βœ” Yes, simultaneously.

Q2: Is EFS AZ-specific?
βœ” No, it is regional.

Q3: Which protocol does EFS use?
βœ” NFS (Port 2049).

Q4: Can Windows use EFS?
βœ” No, only Linux supports EFS.


1️⃣2️⃣ One-Line Interview Answer

Amazon EFS is a fully managed, scalable, shared file system that allows multiple EC2 instances across availability zones to access the same data using NFS.


Thank You

πŸ”— Connect With Me

🌐 Platform πŸ”— Link
πŸ™ GitHub https://lnkd.in/d2F3JPa3
✍️ Dev.to Blog https://lnkd.in/dNtgqAME
πŸ’Ό LinkedIn https://lnkd.in/d3NctxFT
πŸ“„ Resume (Google Drive) https://lnkd.in/dHDNsd_D

πŸ”– Hashtags

AWS #DevOps #CloudComputing #AWSLearning #EBS #VolumeMounting #DataPersistence #LearningJourney #CareerGrowth #DevOpsEngineer #AWSCommunity


⭐ If you like this guide, don’t forget to star the repo!

Top comments (0)