Steps to Mount EFS to EC2
1) Create EC2 instance linux based with port 22 open as EFS doesn’t support
windows based systems.
2) Create a Security group for EFS to monitor traffic flow.
3) Create a File System and mount on an EC2 instance.
4) Let us create 2 security groups one for instance and other for file system.
Create a Security Group
Click on Create Security Group
Create a security group for ec2 instance.
Fill in the details and allow ssh port. Create a security group
Now create one more security group for EFS with port-22 open.
Create a Security Group.
Now let's create a file system. Go to EFS service and create a file system
Click on create file system.
Give a name and click on customize to choose our VPC as we need add Security
group to the file system.
Click on Customize.
I will not change default settings. Click on Next.
In the next step Network access we will change Security Groups.
We will remove all our Security Group and set our security groups.
Now we are creating a subnet as EC2 instance should be connected to EFS no
matter where the availability zone is. Click on Next.
You can select on File System. As of now let it be as it is.
Click on Next. Review and Create.
File System is getting created.
Go to file system > Network. We will see the it is still getting created.
Now lets create an Amazon linux EC2 instance
Select a subnet.
Select Existing Security Group.
In Storage Volume .
Add EFS
Click and launch Instance.
We will check for EC2 status
Go to EC2 instance and click on connect.
Click on connect
Go to your EC2 instance and type df -T -h
This command will help EC2 mounted on EFS. if you create another EC2 make
some changes and mount on EFS you can see the changes visible in another EC2
instance