Monday, November 27, 2023

AWS Tips - Create and Mount an EFS File System

  

Scenario

You could think EFS as a cloud version network file system which is very common in an on-premises environment. Moreover, it comes with all cloud features such as scaling on demand to petabytes, providing high availability across multiple Availability Zones, allowing massive parallel access, protecting data securely, etc. It can be mounted not only on multiple EC2 instances across AZs but also on an on-premises server.



EFS

We’ll walk through how to create an EFS file system and how to mount it on a Linux instance.



Examples


Create an EFS File System


Navigate to Elastic File System service and select File systems, you’ll see a list of currently available File systems under your account.

Click Create File system.


Enter a preferred name in Name textbox.

Under Storage class, you can choose either Standard or One Zone.

Standard class indicates that the files will be saved across all AZs in the AWS Region, providing the best availability and durability.

One Zone class indicates that the data will be stored in the AZ you specified.

We select Standard class. 

In this demo, we disable automatic backup and encryption features.



For Performance settings, you can configure Throughput mode and Performance mode based on your requirements.

Throughput mode - Elastic, Provisioned or Bursting. If your workloads can be estimated beforehand, recommend you selecting Provisioned mode. if not, Elastic mode.

Performance mode - General Purpose or Max I/O. General Purposed is recommended for higher performance.

We select Elastic throughput and General Purpose for the EFS.

Click Next.



Under Network access, you’ll need to set up the VPC and Mount targets. By default, a Mount target is created in each AZ in the VPC and is assigned an IP address. The VPC default Security group is attached to the Mount target, but you can switch to a custom one.

Click Next.



For reference, when you choose One Zone storage class, you’ll need to specify an AZ to host the file system, as shown in the below screenshot.



Under File system policy, you can define more detailed access control. We leave it blank in this demo.

Click Next.



We come to the Review and create page. Should you wan to make any changes to the configuration, you can go back and modify as necessary.

Click Create.





The Console navigates back to File systems home page, with a top status bar indicating the progress of creation.



Click View File system, you’ll find all the details of the newly created EFS.




Mount an EFS File System


We can use the EFS file system ID, DNS name or Mount target to mount the file system on a Linux instance. Before mount, we’ll need to install the EFS mount helper first by using the command below. 

sudo yum install -y amazon-efs-utils


Mount using EFS file system ID.

sudo mount -t efs fs-0a804cfa6b880ad32 efs/


Mount using EFS file system DNS name.

sudo mount -t efs -o tls fs-0a804cfa6b880ad32.efs.us-west-2.amazonaws.com efs/


Mount using the mount target IP address.

sudo mount -t efs -o tls,mounttargetip=172.31.49.219 fs-0a804cfa6b880ad32 efs/


To delete an EFS File System, select the target file system and click Delete.



An EFS file system can be mounted on an EC2 instance in another AWS Region. You can create also an EFS file system under Configure storage while you are creating a Linux instance. 


No comments:

Post a Comment

AWS - Build A Serverless Web App

 ‘Run your application without servers’. The idea presented by the cloud service providers is fascinating. Of course, an application runs on...