Step 1:
create security group for nfs access points
The source needs to be the target servers
Step 2:
create file system
while creating file system make sure to select the proper security group
Step 3:
login to ubuntu and create folder /mnt/efs/
mkdir /mnt/efs/
Step 4:
install amazon-efs-utils package
For information you can visit to [Manually installing the Amazon EFS client – Amazon Elastic File System]
Follow following commands to install on Ubuntu
sudo apt update
sudo apt -y install git binutils
git clone https://github.com/aws/efs-utils
cd efs-utils
./build-deb.sh
sudo apt -y install ./build/amazon-efs-utils*deb
Step 5:
visit efs section click on file system id
from the details page find out the attach button and click on to get the command
in my case i got following using EFS Mount:
sudo mount -t efs -o tls fs-radond-number-of-efs-id:/ /mnt/efs/app.example.com
mount file system automatically on reboot
This is must follow step without this your efs file system will not be useful
Step 1:
Make sure to replace the id of your file system id
add following line to fstab – so that it will automatically mount to your server when system get rebooted
nano /etc/fstab
fs-eft-id.efs.us-east-1.amazonaws.com:/ /mnt/efs nfs4 _netdev,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nofail 0 0
Step 2:
Ensure that on the fstab file you use the exact path
sudo mount -fav
unmount
sudo umount /mnt/efs
or
sudo umount -f /mnt/efs
assign write access to the web user
Assign the proper access so that web server(s) should be able to write/store whatever want store
cd /mnt/efs
sudo chgrp -R www-data app.example.com
sudo chmod -R ug+rwx app.example.com
Mounting via IP
Install the botocore lib
apt install python3-pip
sudo pip3 install botocore
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport <REPACE_IP_ADDRESS_HERE>:/ efs