Monday, 20 May 2019

How To Mount An EFS File System To Running EC2 Server By Raj Gupta




1. If you're using an Amazon Linux EC2 instance, install the EFS mount helper with the following command:

sudo yum install -y amazon-efs-utils

You can still use the EFS mount helper if you're not using an Amazon Linux instance.

If you're not using the EFS mount helper, install the NFS client on your EC2 instance:

On a Red Hat Enterprise Linux or SUSE Linux instance, use this command:
sudo yum install -y nfs-utils

On an Ubuntu instance, use this command:

sudo apt-get install nfs-common

2. Create a new directory on your EC2 instance, such as "efs".


[root@ip-172-31-18-222 ~]# sudo mkdir efs

3. Mount your file system with a method listed following. If you need encryption of data in transit, use the EFS mount helper and the TLS mount option. 

Using the EFS mount helper:
[root@ip-172-31-18-222 ~]# sudo mount -t efs fs-759c3196:/ efs


Using the EFS mount helper and the TLS mount option:
[root@ip-172-31-18-222 ~]# sudo mount -t efs -o tls fs-759c3196:/ efs

Using the NFS client:
[root@ip-172-31-18-222 ~]# sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-759c3196.efs.us-east-1.amazonaws.com:/ efs

To check the EFS mount point the the below command:- 

[root@ip-172-31-18-222 ~]# df -h
Filesystem                                 Size  Used Avail Use% Mounted on
devtmpfs                                   483M   64K  483M   1% /dev
tmpfs                                      493M     0  493M   0% /dev/shm
/dev/xvda1                                 7.9G  1.1G  6.7G  14% /
fs-759c3196.efs.us-east-1.amazonaws.com:/  8.0E     0  8.0E   0% /root/efs
127.0.0.1:/                                8.0E     0  8.0E   0% /root/efs
fs-759c3196.efs.us-east-1.amazonaws.com:/  8.0E     0  8.0E   0% /root/efs

No comments:

Post a Comment