Mounting EFS File Systems

In the following section, you can learn how to mount your Amazon EFS file system on
a Linux
instance using the Amazon EFS mount helper. In addition, you can find how to use the
file fstab to automatically remount your file system after any
system restarts.

Troubleshooting AMI and Kernel
Versions

Installing the amazon-efs-utils
Package

To mount your Amazon EFS file system on your Amazon EC2 instance, we recommend that
you use the
mount helper in the amazon-efs-utils package. The amazon-efs-utils package is an open-source
collection of Amazon EFS tools. For more information, see Installing the amazon-efs-utils Package on Amazon
Linux.

Mounting with the EFS Mount Helper

You can mount an Amazon EFS file system on a number of clients using the Amazon EFS
mount helper.
The following sections, you can find the mount helper process for the different types
of
clients.

Mounting on Amazon EC2 with the EFS Mount
Helper

You can mount an Amazon EFS file system on an Amazon EC2 instance using the Amazon
EFS mount helper.
For more information on the mount helper, see EFS Mount Helper. To use the mount helper, you need the
following:

An Amazon EFS file system ID – After you create an
Amazon EFS file system, you can get that file system's ID from the console or
programmatically through the Amazon EFS API. This ID is in this format:
fs-12345678.

An Amazon EFS mount target – You create mount
targets in your virtual private cloud (VPC). If you create your file system in the
console, you create your mount targets at the same time. For more information, see
Creating a Mount Target Using the Amazon EFS
console.

An Amazon EC2 instance running a supported distribution of
Linux – The supported Linux distributions for mounting your file
system with the mount helper are Amazon Linux 2, Amazon Linux 2017.09 and newer, Red
Hat
Enterprise Linux (and derivatives such as CentOS) version 7 and newer, and Ubuntu
16.04
LTS and newer.

Access the terminal for your instance through Secure Shell (SSH), and log in with
the appropriate user name. For more information on how to do this, see Connecting to Your Linux Instance
Using SSH in the Amazon EC2 User Guide for Linux Instances.

Run the following command to mount your file system.

sudo mount -t efs fs-12345678:/ /mnt/efs

Alternatively, if you want to use encryption of data in transit, you can mount your
file system with the following command.

Mounting with the mount helper automatically uses the following mount options that
are
optimized for Amazon EFS:

nfsvers=4.1

rsize=1048576

wsize=1048576

hard

timeo=600

retrans=2

noresvport

To use the mount command, the following must be true:

The connecting EC2 instance must be in a virtual private cloud (VPC) based on the
Amazon VPC service.
It also must be configured to use the DNS server provided by Amazon. For
information about the Amazon DNS server, see DHCP Options Sets in the
Amazon VPC User Guide.