Setting up EFS and mounting it on an EC2 instance

Using the AWS Management Console, open the Amazon EC2 service dashboard.

Launch and or create and launch a Linux instance and launch one – t2.micro is cheapest that is usable.

Create the EFS Storage

From the AWS Console open the Amazon EFS service dashboard under “Storage”.

Select EFS -> Select Create File System. ​

Make sure you select the Amazon VPC where your Linux instance is running.

Accept the default mount targets, and make note (IMPORTANT) of the security group ID assigned to the targets.

Choose any settings, and then create the file system.

Modify your  EC2 instance to use the EFS you just created

Assign the same default security group (use the security group ID you made note of above) used by the file system to your Linux instance.  Your EFS storage you created will also show you the security group if you did not make note.

See the screen shot below on how to change your EC2 instance security group:


Change your security group on the EC2 instance to match the EFS storage you created by clicking on “Change Security Groups”

Log in / SSH to the console of the Linux instance, and install the NFS client on the Amazon EC2 instance.

For Amazon Linux and other RHEL clone AMIs:

sudo su - root
yum install -y nfs-utils
yum install -y amazon-efs-utils

Create a new directory on your Amazon EC2 instance, such as myefs:

sudo mkdir /myefs

Mount the file systems

mount -t efs fs-12345678:/ /myefs

You have now mounted the Amazon EFS volume to the instance.

Keep in mind – you will have to modify fstab (for RHEL and AWS RHEL AMI clones) to auto mount this every time – beyond the scope of this posting.

Here is a screen show of the EFS definition – note it has a link to instructions for mounting on both EC2 and on premise instances vis AWS Direct Connect.


More from LonzoDB on AWS

Leave a Reply

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