Using AWS EFS to Replace Complex Clustered Filesystem Setups

3781 VIEWS

During my career, I have seen many different ways of creating shared storage for multiple web servers or database servers. It’s not always an easy thing to do. For one, you have to worry about file locking and file systems that support clustering.

But there’s a solution. A relatively new service in AWS is Elastic File System (EFS), which takes away the headache of maintaining your own NFS or iSCSI implementation, and allows you to scale indefinitely as required.

In this article I’m going to illustrate how to set up EFS and mount the export on your servers.

Objectives

  • Configure EFS within AWS Console
  • Mount EFS filesystem on one or more servers

Configure EFS within AWS Console

To create your elastic file system, navigate to the Elastic File System button under Services in the Amazon console. Then click Create File System. You’ll be asked to specify the VPC and availability zones you want this deployed to. Select the choices relevant to your use case.

step1.png

Stick with the defaults for any other choices unless you specifically want to use other functionality.

Now your filesystem will be in the process of being created, and you should see something similar to the following:

 

step2.png

In order to connect to our new EFS NFS export, we’ll need to install a few tools on our OS. A couple of examples of how to do this follow:
On an Amazon Linux, Red Hat Enterprise Linux, or SuSE Linux instance:

sudo yum install -y nfs-utils

On an Ubuntu or Debian instance:

sudo apt-get install nfs-common

Then, let’s go ahead and create a directory for our EFS export to be mounted under:

mkdir /mnt/efs

Mount the EFS filesystem on 1 or more servers

Now we can go ahead and mount the filesystem. The command to do this can be obtained from the instructions link provided after creating your filesystem. It will provide you with a unique hostname.

Once it’s mounted, you should see a new mount point after running df -h (Look at all that space!):

step3.png

You’re now good to go! You can simply use the mount command provided in the instructions on each of your instances to mount the shared EFS storage.

Conclusion

EFS is a fantastic replacement for your own Gluster, NFS or iSCSI implementation. It reduces complexity, is easy to set up, and is cost effective.

From start to finish, I had this up and running in around 15 minutes.

Resources


Keith Rogers is an IT professional with over 10 years’ experience in modern development practices. Currently he works for a broadcasting organization in the DevOps space with a focus on automation. Keith is a regular contributor at Fixate IO.


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: