How To Mount the EFS file system on the EC2 instance

Published on November 22, 2022

By Hyuntaek Park

Senior full-stack engineer at Twigfarm

Amazon EFS (Elastic File System) is very useful when we need a limitless storage and / or to share the storage with different AWS services such as lambdas, another EC2 instances, ECSs, etc. In order to start using the EFS on our EC2, we need a little bit of a mounting process.

Although the process is already explained very well, let me explain in my words with a few screenshots for a better understanding.


  • An EFS is created
  • An EC2 instance is created

SSH into the EC2 instance and run the mount command

First, ssh into the EC2 instance to run the following commands.

$ mkdir ~/efs-mount-point
$ sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport EFS_DNS_NAME:/ ~/efs-mount-point

You can obtain the EFS_DNS_NAME here and replace it with your EFS DNS name. image

$ cd ~/efs-mount-point

Now you can confirm the EFS is mounted. One thing that you need to keep in mind is that if you restart the EC2 instance, you will have to run the mounting command again.

If you need to setup your EC2 instance to automatically mount the EFS on restarts, then refer to the following link.

Enjoy the flexible and easy to use storage, EFS.