AWS Elastic File System Tutorial
In this tutorial i will be creating an AWS EFS and mount the efs on Linux.
What is EFS?
https://goo.gl/uCmEEX
Amazon Elastic File System or AWS EFS provides a very simple out of the box scalable file storage, the size of efs is increasing and decreasing automatically based on the need and your usage, you can mount that storage type on multiple of EC2 servers which is not the case with other storage.
Create EFS And Mount It
Create EFS
Login to your console
Search for EFS service inside AWS services search box
Select 'create EFS'
Select VPC and the availability zones you want to enable for your EFS 'Be sure to attache a security group which has the NFS port opened'.
Add tags if needed.
Choose MAX I/O if EFS will be attached to 20-100+ instances with high frequency access otherwise choose general purpose.
Review configuration and select 'Create File System'.
It takes sometimes to be created in all zones, once it's done it will show green 'Available' text under 'Life cycle state' column.
Copy the DNS name which will be used for mounting purpose.
Mount EFS on EC2 instance
Connect to your EC2 instance "For this tutorial i am using a RedHAT 7 box"
Install nfs utilities
yum -y install nfs-utils
Create a folder to use it as an EFS mounting point.
mkdir /var/www/mymount
Run below mount command by replacing both the folder name and the DNS name with the ones you have.
mount -t nfs4 fs-xxxxxxxxxx.efs.us-east-1.amazonaws.com:/ /home/ec2-user/myMount
Confirm the mount
df -hT /home/ec2-user/myMount
Above command should give an output shows that folder is pointed and mounted to the EFS using nfs4.
To mount the EFS permenantly or have it mounted when system is rebooted you need to add the mount to you /etc/fstab
vi /etc/fstab
fs-xxxxxxxxxx.efs.us-east-1.amazonaws.com:/ /home/ec2-user/myMount nfs4 _netdev 0 0