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.

Image1

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).

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

Image3

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.

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

Image5
Image6
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.

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

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

Image9

Create Two EC2 instances & Attach File system

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

Image10
You can use default settings but also can customize it.

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

Image14

Image15

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.

Image21

Image22
If you face any issue plz watch this file system video below on my youtube channel

https://youtu.be/hz37v1_AL2A?si=TcxZIKq3WlNBmYCz
Enter fullscreen mode Exit fullscreen mode

Top comments (0)