How to create Elastic File System (EFS)

  • Post category:Solutions
  • Reading time:17 mins read

If you’ve ever heard of Amazon’s Elastic Compute Cloud (EC2), then you know what the Elastic File System is. It’s a file system that looks like it’s on your computer, but it lives up in Amazon’s cloud—the same place as EC2 and S3 (Amazon Simple Storage Service). If you’re thinking about using EFS for your next big project or maybe just trying to migrate an old web app into the cloud, this tutorial will show you how to get started.

What is Elastic File System (EFS)?

Amazon Elastic File System (EFS) is a cloud file storage service that can be used with Amazon EC2 instances. It’s elastic because it expands and shrinks as needed, much like AWS EBS does. It has a simple user interface that lets you set up and manage file systems quickly and easily. EBS is comparable to EFS.

The need for such a solution arises from the fact that not all applications running on AWS can directly access block devices inside an instance’s operating system because they were never designed for this purpose. Instead of re-architecting these legacy apps to “talk” to either Amazon Elastic Block Store (EBS) or Amazon Elastic Compute Cloud (EC2), an easier approach is to use AWS EFS.

AWS EFS allows you to create one or more file systems, providing a scalable file system that can be accessed over the network using the standard NFS protocol. You have complete control over your file system, including choice of MTU size, jumbo frames support, encryption, compression, and caching options.

AWS Elastic File System provides managed file storage volumes that can be attached to Amazon EC2 instances. Upon attachment, the file system automatically expands in size and is configured with an IP address that you can use to set up inbound access rules using security groups or network ACLs.

Elastic File Systems are extremely useful in several areas:

  1. Data backup solution for users who don’t want to pay much money on data storage.
  2. A dev-test environment where the developer wants a separate location for their application configurations, content, etc.
  3. An Infrastructure as a Service offering for developers who need persistent block-level storage volumes accessible via HTTP/S APIs.
  4. A fully managed S3-like object storage solution that can be mounted as a file system.

Advantages of Elastic File System

  1. The data stored on this file system is highly durable, as it is replicated within the AWS network and therefore survives the loss of any single facility.
  2. Provides unlimited storage capacity – you pay only for the storage consumed by your files and there is no limit on how much or what types of data you can store in an Elastic File System volume.
  3. High degree of durability – with multiple facilities like Availability Zones, Provisioned IOPS SSD volumes, and replication across AZs built into every Elastic File System volume, your data is highly durable.
  4. You can create up to 20 volumes, 1 TB each (per AWS account), and mount these volumes on as many EC2 instances as you like.
  5.  The Elastic File System persists independently from the life of any single EC2 instance or an EBS volume that may use it, so data stored in the Elastic File System will be available even if the original instance or volume fails or is deleted.
  6. Provides access to S3 APIs making it easy to migrate existing applications to this service without extensive code changes.

Elastic File System Working

  1. It starts with a request for allocation of an EFS file system
  2. Then EFS will automatically create an EFS mount target (a VPC and subnet for communication and a security group and IAM role for access)
  3. Then the data will be uploaded to EFS with S3 bucket as a reference
  4. After uploading, it can be accessed by EC2 instance
  5. Each file has a unique ID. The client application makes API requests specifying this ID as part of the request.
  6. All API calls are logged with information about the user who sent them, so you can build fine-grained access control policies.
  7. One of the most important features is replication: all files within an Elastic File System volume are replicated across multiple Availability Zones and facilities within those zones to ensure durability and high availability of data.
  8. While Elastic File System is highly durable, EFS doesn’t provide the same guarantee for EC2 instances or EBS volumes that are using an EFS file system as storage.
  9. The performance of your EFS file systems will vary depending on several factors, including the size of your volume, which depends on the amount of data stored within it; network bandwidth available between your EC2 instance and your file system; and throughput limits set by AWS.

So let’s get started


  • After clicking on Create File System, click on Customize [so we can search for additional options].

elastic file system

  • The name can be left blank since it is optional. Verify “Enable automatic backups” is already enabled [used to backup network processing]


  • Life cycle management is available there, and EFS frequent access storage class is available here. Keep it as default 30days (as shown in the above figure)
  • Click on next while keeping performance mode and throughput as defaults
  • We can mount it across different AZs within our VPC
  • We can use EFS across different Availability Zones because it is a network file system
  • For each AZ you have to define a security group
  • Create a new Security group from EC2 console
  • Go to EC2 and from the left-hand side you will see Security Groups
  • Click on Security Groups then click on Create and give it a name as “my-efs-demo” and in description copy the same and paste it. Click on create
  • Return to EFS and deselect all security groups and select “my-efs-demo” for each Availability Zone given there and then click on Next
  • Leave the file system policies as it is and then review and create


  • After creation, you will be able to see that EFS is created


  • After the creation of EFS now we have to create 2 EC2 instances which are going to be accessing that file system. 


  • Go to EC2 console create 2 instances using Amazon AMI


  • While creating both the instances remember to select new subnet for each instance don’t keep it as default. Suppose you selected us-east-1a for the first instance so select us-east-1b for the second one


  • Click on Next and directly come to Security groups
  • Here we have to create a new Security Group so click on Create new Security Group and name it as “ec2-to-efs” and keep the description as the same
  •  Click on Next
  • Choose the existing key pair if it is already there otherwise, create a new key pair and download it and click on Launch instances
  • Now quickly login to both the instances at the same time by clicking on Connect. Open a new session for the second instance



  • Now come to EFS console and select the circle and click on View Details


  • After clicking on View details, there is an Attach button, click on that and it will give you how to attach EFS to EC2 instance


  • Leave the default selection as Mount via DNS
  •  Below you will see there is a link to user guide, open that link in the new tab window
  • After opening the user guide scroll down and click on the link “Manually installing Amazon EFS client”


  • Scroll down and copy the command which starts with “sudo”


  • Copy this command and paste in both the EC2 logged instances (press enter) 
  • This will install the necessary package for EFS


  • Come to EC2 instance logged in the window again and type “mkdir efs” (press enter), this will create a directory
  • Come to EC2 console and then go to Security groups
  •  In the search bar type my-efs-demo. In this Security Group, you will see that Inbound rules have not allowed anything. 
  • Click on Edit bound rules and click on Add rule. In type option search for NFS  in source option type ec2-to-efs” and select that 
  •  Click on save rules


  • Now we will run EFS mount helper command to mount EFS drive 
  • Return to EFS and copy that command and paste in both the EC2 logged instances



  • Change directory by typing cd / efs in both sessions of EC2 logged instances
  • We will create a helloworld.txt file here
  • Now type “sudo touch hello-world.txt” in both the sessions (press enter)
  • To confirm type lsblk and it will show hello-world file


  • For editing type sudo vi hello-world.txt (press enter) then press “i” and then type “hello world
  • Then press Escape (ESc key) and type :wq! (press enter) and you will be out of the editor
  • To look into the content type “cat hello-world.txt“. you will see that it is mounted now
  • Please perform all the steps in both the EC2 logged instances
  • After getting the desired output terminate both the EC2 instances and Elastic File System


  • Please perform all the steps in both the EC2 logged instances
  • After getting the desired output terminate both the EC2 instances and Elastic File System


The Elastic File System is a cloud computing technology that can help you overcome challenges with data storage. If you are looking for ways to improve your data management, the EFS may be the answer. Read on to learn more about how this system works and its benefits so you can decide if it would work well in your company’s environment. We have plenty more information about cloud computing technologies here at  – check out our blogs or courses today if you want to learn more.

Interview Prepration Quiz

Category : Quiz
AWS Database Interview Questions | Elastic Load Balancer Interview Questions | Auto Scaling Group Interview Questions | Basics of Cloud Interview Questions | IAM Interview Questions | Introduction to Cloud Computing Interview Questions | Azure Services Interview Questions | Basic ure Concepts Interview Questions | Azure Storage Interview Questions | Management Tools on Azure Interview Questions | Introduction to Comput Networking Interview Questions | Authentication and Authorization Interview Questions | Elastic Block Storge Interview Questions | Elastic File System Interview Questions | S3 Interview Questions | Simple Queue Service Interview Questions

Leave a Reply