Amazon EFS
Amazon EFS can be used to mount same drive on multiple EC2 instances allowing you to make web site scale on multiple web servers.
To mount EFS drive on Ubuntu, you need to install
1 |
apt-get -y install nfs-common |
To mount a EFS drive, run
1 2 |
mkdir /efs mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-YOUR-ID.efs.us-east-1.amazonaws.com:/ /efs |
Here is fstab entry for auto-mount efs on boot. Here it is mounted /efs, all website files reside in EFS.
1 2 3 4 |
root@ip-10-0-0-224:~# cat /etc/fstab LABEL=cloudimg-rootfs / ext4 defaults,discard 0 0 fs-4fg8d351.efs.us-east-1.amazonaws.com:/ /efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0 root@ip-10-0-0-224:~# |
Or
1 |
fs-a27131eb.efs.us-east-1.amazonaws.com:/ /efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,_netdev 0 0 |