DEV Community

Cover image for Mount AWS EFS to multiple instances
Muhammad Awais Zahid
Muhammad Awais Zahid

Posted on

Mount AWS EFS to multiple instances

Steps To Follow

  1. Create a VPC and Subnets
  2. Create a Security Group
  3. Create an Amazon Elastic File System(EFS)
  4. Create Two EC2 instances
  5. Attach File System
  6. Test File System

Create a VPC and Subnets

First of all, you have to create a vpc and two subnets in that vpc. you also can use default vpc in your AWS account. you also use the following CIDR for new vpc.


Create a Security Group

In security group section create a security group in your vpc and add three rules in inbound rule (HTTP, SSH, NFS).

I did not add port 22 but you have to enable it.


Create an Amazon Elastic File System(EFS)

In amazon console search bar just type efs and click on it.
you will see following interface and click on customize.

Now configure first step, you can also use default settings in step-1.

Now click on next and configure the network settings.
In network setting choose vpc in which you want to create file system and choose mount targets in which you will create your ec2 instances.

Click on next and at step 3 keep it default and go to next section.

On step 4 review it and click on create.
Your file system will look like this.


Create Two EC2 instances & Attach File system

Click on launch instance and create two instances of same steps.

You can use default settings but also can customize it.

Make sure in network settings choose your vpc and subnets that you selected during file system creation.
In storage section click on edit for file system and choose efs file system.



Test File System

Now take SSH of your both ec2 instances, go to mount point directory and test either file system is working or not.


If you face any issue plz watch this file system video below on my youtube channel
Enter fullscreen mode Exit fullscreen mode

Top comments (0)