Customers who sign-up prior to 30/06/2024 get unlimited access to free features, newer features (with some restrictions), but for free for at least 1 year.Sign up now!

How to mount EFS on EC2 Ubuntu instances and automount on reboot

EFS stands for Elastic File System. EFS is a network filesystem where data can persistent and can be accessed by several different EC2 instances.

In pursuit of having my own crash-resistant, tamper-proof, immutable logs and any other future sensitive information I wanted to leverage EFS in my startup ALight Technology And Services Limited.

This article does not discuss EFS in-depth i.e throughput types, Standard vs One Zone etc.. This article is simply about how to mount and automatically mount.

  1. Create the EFS in the region where you need. My current datacenter is in London, United Kingdom because my company is registered in London, United Kingdom (Once again my sincere respect and gratitude for the Government of United Kingdom)
  2. In your EC2 security groups allow port 2049, attach the EC2’s security groups in the networking section of the EFS.
  3. Install the required software
sudo apt install nfs-common -y && \
    sudo systemctl status nfs-utils

4. The command for mounting can be found in EFS, click the EFS name, click “Attach” and you can get the instructions:

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport <FS_ID> <YOUR_MOUNT_POINT>

5. Copy some file

6. Edit /etc/fstab and add the following line mount_point nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0

Update the above bolded text as per your configuration.

7. Reboot

8. See if the filesystem got attached

Reference List

Mounting on Amazon EC2 Linux instances using the EFS mount helper – Amazon Elastic File System (no date). Available at: (Accessed: February 1, 2023).

Using NFS to automatically mount EFS file systems – Amazon Elastic File System (no date). Available at: (Accessed: February 1, 2023).