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 an 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.

To create an extremely useful AWS Elastic File System (EFS), it’s crucial to understand how to efficiently upload files to your Elastic File System. EFS offers a scalable and highly available file storage solution that can be a game-changer for your cloud-based applications. To get started, you’ll want to leverage AWS’s robust ElasticFileSystem features, such as multi-AZ deployments for high availability and low latency access. Additionally, using AWS Transfer for SFTP or integrating with AWS Lambda can automate file uploads to your EFS, ensuring a seamless and efficient data transfer process. By harnessing the power of EFS and optimizing file upload workflows, you can unlock the full potential of this versatile storage solution for your AWS-based projects.

Elastic File Systems are extremely useful in several areas:

  1. Data backup solution for users who don’t want to pay much money for 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. The 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.

Build Your Career as a
AWS Solution Architect

AWS Solutions Architect Associate

Boost your earning potential with AWS expertise. Explore our certified AWS Courses for a high-paying career

Elastic File System Working

  1. It starts with a request for the 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 an S3 bucket as a reference
  4. After uploading, it can be accessed by the 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

EFS

  • 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]

EFS

  • Life cycle management is available there, and EFS frequent access storage class is available here. Keep it as default 30 days (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 the 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

EFS

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

EFS

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

EFS

  • Go to EC2 console and create 2 instances using Amazon AMI

EC2

  • While creating both instances remember to select a 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

EFS

  • 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 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 log in to both instances at the same time by clicking on Connect. Open a new session for the second instance

EFS

EFS

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

EFS

  • 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

EFS

  • Leave the default selection as Mount via DNS
  •  Below you will see there is a link to the 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”

EFS

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

EFS

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

EFS

  • Come to the EC2 instance logged in the window again and type “mkdir efs” (press enter), this will create a directory
  • Come to the EC2 console and then go to the 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 the type option search for NFS  in the source option type ec2-to-efs” and select that 
  •  Click on Save rules

EFS
EFS

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

EFS

EFS

  • Change the 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

EFS

  • 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

EFS

  • 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

AWS EFS: Scalable Shared File Storage

Amazon Elastic File System (EFS) is a scalable and managed file storage service provided by AWS. It offers a shared file storage system that can be accessed concurrently by multiple Amazon EC2 instances and on-premises servers. EFS is designed to be highly available and durable, automatically scaling up or down based on the storage needs of applications. It simplifies the process of sharing files between instances and provides a consistent file system interface. EFS is particularly useful for applications that require shared access to files, making it easier to manage and maintain data consistency across multiple instances within an AWS environment.

Read more free resources from Thinkcloudly

  • Top AWS IAM interview questions.
  • Top EC2 questions and answers.
  • Top S3 bucket interview questions.
  • Most in-demand Azure SQL server interview questions.
  • Most useful AWS route 53 interview questions.

Conclusion:

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 Thinkcloudly – check out our blogs or courses today if you want to learn more.