top of page

Amazon Elastic File System (Amazon EFS)


Shared File Storage for Multi-AZ Applications


1. Overview


In cloud computing, servers are not permanent.They can be stopped, replaced, or scaled automatically based on demand.


Because of this behavior, storing application data directly on servers is not recommended for production workloads.


Amazon Elastic File System (Amazon EFS) is a fully managed file storage service that enables multiple Amazon EC2 instances to access shared data concurrently. Amazon EFS is designed to be highly available and accessible across multiple Availability Zones within an AWS Region.



2. Architecture Explanation


The diagram illustrates how Amazon EC2 instances deployed across multiple Availability Zones access a shared Amazon EFS file system.
The diagram illustrates how Amazon EC2 instances deployed across multiple Availability Zones access a shared Amazon EFS file system.

In the illustrated architecture:


  1. The outer green boundary represents a single AWS Region

  2. Inside the Region, there are two Availability Zones: AZ1 and AZ2

  3. The EFS component shown at the bottom of the diagram represents a single Amazon EFS file system that is shared across Availability Zones.


  4. The IP labels in the diagram represent the private IP addresses of the EFS mount targets used by EC2 instances for NFS connectivity.


EC2 Instances (Server1 and Server2)

  • Server1 is deployed in AZ1

  • Server2 is deployed in AZ2

  • Both servers run the same application workload

  • The servers do not store application data locally


Amazon EFS (Elastic File System)

  • Amazon EFS is shown as a central shared file system

  • It operates at the regional level

  • The same EFS file system is accessible from multiple Availability Zones


IP-Based Connectivity (Mount Targets)

  • Each Availability Zone has its own EFS mount target

  • The mount targets are represented by the connection points labeled as IP addresses

  • EC2 instances connect to the EFS file system using these AZ-specific IP addresses

  • This ensures low latency and high availability


How Data Access Works

  • Server1 and Server2 mount the same EFS file system

  • Any file written by Server1 is immediately available to Server2

  • The file system remains available even if one Availability Zone becomes unavailable


Architectural Outcome

  • Compute (EC2) is decoupled from storage (EFS)

  • The application supports multi-AZ availability

  • The design is suitable for Auto Scaling and production workloads


3. Key Concepts and Terminology


Amazon Elastic File System (EFS)

Amazon EFS provides shared file storage that can be mounted on multiple EC2 instances at the same time.


  • Definition (Exam / Interview): A fully managed, scalable file storage service that uses the NFS protocol

  • AWS Real-Time Scenario: Used to store shared application files such as uploads, images, and reports



Mount

Mounting is the process of making a file system accessible at a directory in the operating system.


  • Definition (Exam / Interview): The process of attaching a file system to a directory

  • AWS Real-Time Scenario: EC2 instances mount EFS at directories such as /var/www/html



Availability Zone (AZ)

An Availability Zone is an isolated data center within an AWS Region.


  • Definition (Exam / Interview): An isolated location designed to provide fault tolerance

  • AWS Real-Time Scenario: Applications are deployed across multiple AZs to improve availability



Mount Target

A mount target is an endpoint that allows resources in a specific Availability Zone to connect to an EFS file system.


  • Definition  (Exam / Interview): A network interface that enables access to an EFS file system

  • AWS Real-Time Scenario: One mount target is created per AZ for EC2 access



Network File System (NFS)

NFS is a protocol that allows file access over a network.


  • Definition   (Exam / Interview): A distributed file system protocol for network-based file access

  • AWS Real-Time Scenario: Linux EC2 instances access EFS using NFS version 4



Stateless Application

A stateless application does not store data on the compute instance itself.


  • Definition (Exam / Interview):  An application that stores state externally

  • AWS Real-Time Scenario: Enables Auto Scaling without data dependency on individual EC2 instances



4. AWS Real-Time Scenarios


Scenario 1: Multi-AZ Web Application

A web application runs on multiple EC2 instances behind an Application Load Balancer. Users upload images and documents.


Using Amazon EFS:

  • All EC2 instances access the same uploaded files

  • Files remain available even if instances are replaced

  • Application remains consistent across Availability Zones



Scenario 2: Auto Scaling Workloads

Traffic increases and Auto Scaling launches new EC2 instances.


Using Amazon EFS:

  • New instances mount the existing file system

  • Application data is immediately available

  • No manual file synchronization is required



5. Quick Summary for Understanding (Before Interview)


  • Amazon EC2 instances are temporary

  • Application data should not be stored locally on EC2

  • Amazon EFS provides shared file storage

  • EFS supports multiple EC2 instances simultaneously

  • EFS is multi-AZ by default

  • Uses the NFS protocol

  • Ideal for highly available and scalable applications


6. Interview Questions and Answers



Q1. Why is storing application data directly on EC2 not recommended?

Answer:


Because EC2 instances can be terminated or replaced, resulting in data loss.

Q2. Why is Amazon EFS preferred over Amazon EBS for shared storage?

Answer:

Amazon EBS can be attached to only one EC2 instance at a time, whereas Amazon EFS supports concurrent access by multiple EC2 instances.

Q3. Is Amazon EFS limited to a single Availability Zone?

Answer:

No. Amazon EFS is a regional service designed to be accessible across multiple Availability Zones.




7. Real-Time Interview Scenarios


Scenario 1: Shared File Visibility Issue


Question: A web application runs on multiple EC2 instances, but uploaded files are not visible on all servers. How would you fix this?


Expected Answer: Store uploaded files on Amazon EFS and mount the same file system on all EC2 instances.



Scenario 2: Auto Scaling Consistency


Question: How do you ensure new EC2 instances launched by Auto Scaling have access to existing application files?


Expected Answer: By mounting the existing Amazon EFS file system during instance startup.



Scenario 3: High Availability Requirement


Question: Which AWS storage service ensures file availability even if one Availability Zone fails?


Expected Answer: Amazon EFS, because it is designed for multi-AZ access and high availability.



8. Key Takeaways


  • Amazon EFS provides shared file storage

  • Supports multi-AZ architectures

  • Enables Auto Scaling without data loss

  • Commonly used in production workloads



Final Note


Understanding Amazon EFS and this architecture provides a strong foundation for designing reliable, scalable, and production-ready AWS applications.



 
 
 

Comments


Aarvetex

Contact Us -

Sathya - Cloud & Devops Expert ​

Phone - +91 9182760174
bottom of page