Creating AWS EFS Volume and Mounting on AWS Servers

Firstly you will need to create your EFS volume. This can be done from the AWS console, ensure the EFS volume is created within the correct VPC for your servers to access it and note the destination IP addresses provided on the completion page.
Now, you will need to install the NFS package on the machine on which you will be mounting the volume

sudo apt-get install nfs-common
sudo yum install -y nfs-utils

Now, create Inbound / Outbound rules on the Security groups on AWS as follows:

INBOUND port 2049 on the Security Group containing your EFS volume (Noted on the EFS Management Page)
OUTBOUND port 2049 on the Security Group containing the server on which you wish to mount the volume

Now run the below command, updating the IP address of the EFS volume and the local directory on which you would like to mount the volume

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 [IP ADDRESS]:/ /local/dir

To permanently map this EFS volume onto your EC2 Server, add a line to /etc/fstab as below (replacing appropriate sections):

[EFS-IP-ADDRESS]:/ /local-dir/ nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0

Any comments or questions? Get in touch here or Email me at [email protected]