Installing the NFS client
To mount your EFS file system on your Amazon EC2 instance, first you need to
install an NFS client. To connect to your EC2 instance and install an NFS client, you need the
public DNS name of the EC2 instance and a user name to log in. That user name for your
instance is typically ec2-user
.
To connect your EC2 instance and install the NFS client
-
Connect to your EC2 instance. For more information, see Connect to your EC2 instance in the Amazon EC2 User Guide.
The key file cannot be publicly viewable for SSH. You can use the chmod 400
filename
.pem command to set these permissions. For more information, see Create a key pair for your Amazon EC2 instance. -
(Optional) Get updates and reboot.
$
sudo yum -y update$
sudo reboot -
After the reboot, reconnect to your EC2 instance.
-
Install the NFS client.
If you're using an Amazon Linux AMI or Red Hat Linux AMI, install the NFS client with the following command.
$
sudo yum -y install nfs-utilsIf you're using an Ubuntu Amazon EC2 AMI, install the NFS client with the following command.
$
sudo apt-get -y install nfs-common -
Start the NFS service using the following commands. For RHEL 7:
$
sudo service nfs start
For RHEL 8:
$
sudo service nfs-server start
-
Verify that the NFS service started, as follows.
$
sudo service nfs status
Redirecting to /bin/systemctl status nfs.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled) Active: active (exited) since Wed 2019-10-30 16:13:44 UTC; 5s ago Process: 29446 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS) Process: 29441 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS) Process: 29439 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 29446 (code=exited, status=0/SUCCESS) CGroup: /system.slice/nfs-server.service
If you use a custom kernel (that is, if you build a custom AMI), you need to include at a minimum the NFSv4.1 client kernel module and the right NFS4 userspace mount helper.
Note
If you choose Amazon Linux AMI 2016.03.0 or
Amazon Linux AMI 2016.09.0 when launching your Amazon EC2
instance, you don't need to install nfs-utils
because it's already included
in the AMI by default.
Next: Mount your file system
Use one of the following procedures to mount your file system.