Skip to main content

Command Palette

Search for a command to run...

Creating an Amazon EFS File System

Updated
3 min read
Creating an Amazon EFS File System
A

I'm AWS Certified Solution Architect. I do write about the AWS Cloud Operation, Migration, Security and Automations.

Amazon Elastic File System (Amazon EFS) provides serverless, fully elastic file storage so that you can share file data without provisioning or managing storage capacity and performance. Amazon EFS is built to scale on demand to petabytes without disrupting applications, growing and shrinking automatically as you add and remove files.

The service is designed to be highly scalable, highly available, and highly durable.

Task 1: Creating a security group to access EFS file system

The security group that we associate with a mount target must allow inbound access for TCP on port 2049 for Network File System (NFS). This is the security group that we will now create, configure, and attach to your EFS mount targets.

  • At the top of the AWS Management Console, in the search box, search for and choose EC2.

  • In the navigation pane on the left, choose Security Groups.

  • Choose Create security group then configure:

    • Security group name: EFS Mount Target

    • Description: Inbound NFS access from EFS clients

    • Select the VPC

    • Under the Inbound rules section, choose Add rule then configure:

      • Type: NFS

Task 2: Creating an EFS file system

EFS file systems can be mounted to multiple EC2 instances that run in different Availability Zones in the same Region. These instances use mount targets that are created in each Availability Zone to mount the file system

  • At the top of the AWS Management Console, in the search box, search for and choose EFS.

  • Choose Create file system.

  • In the Create file system window, choose Customize.

    • Uncheck Enable Automatic backups.

    • Lifecycle management:

      • for Transition into IA Select None.
    • In the Tags optional section, configure:

      • Key: Name

      • Value: MY First EFS File System

      • Attach the EFS Mount Target security group to each Availability Zone mount target by choosing EFS Mount Target for each Availability Zone.

Task 3: Creating a new directory and mounting the EFS file system

  • In your EC2 terminal session, run the following command to install the required utilities:

      sudo su -l ec2-user
      sudo yum install -y amazon-efs-utils
      sudo mkdir efs
    

  • At the top of the AWS Management Console, in the search box, search for and choose EFS.

  • Choose My First EFS File System.

  • In the Amazon EFS Console, on the top right corner of the page, choose Attach to open the Amazon EC2 mount instructions.

  • Copy the above NFS client section and paste it in your terminal to mount the EFS with the system.

  • df -hT to view the disk usage in the system, you can see the Type nfs4 with <ip address> in the file system.

Task 4: Examining the performance behavior of your new EFS file system

Examining the performance by using Flexible IO

Flexible IO (fio) is a synthetic I/O benchmarking utility for Linux. It is used to benchmark and test Linux I/O subsystems.

sudo fio --name=fio-efs --filesize=10G --filename=./efs/fio-efs-test.img --bs=1M --nrfiles=1 --direct=1 --sync=0 --rw=write --iodepth=200 --ioengine=libaio

Monitoring performance by using Amazon CloudWatch

  • At the top of the AWS Management Console, in the search box, search for and choose CloudWatch.

  • In the navigation pane on the left, choose All Metrics.

  • In the All metrics tab, choose EFS.

  • Choose File System Metrics.

  • Select the row that has the PermittedThroughput Metric Name.

  • Choose the Graphed metrics tab.

  • On the Statistics column, select Sum.

  • On the Period column, select 1 Minute.

Congratulations!!!

You created an EFS file system, mounted it to an EC2 instance, and ran an I/O benchmark test to examine its performance characteristics.

More from this blog

Abishek Gautam | Cloud & DevOps

15 posts

Hands-on blogs on AWS Cloud, DevOps, migration, monitoring, security, and real-world architectures.