This blog describes how to create and attach EFS Volume by using Linux through Private IP.
Creation of EFS Volume
Step 1: Click the create file system option in the EFS console and we will get a pop-up window. Just click the customize option for the creation of EFS Volume.

Step 2: Provide a name for the File System and select regional.
We are going to store our application data in this File system. So selecting regional is recommended for this purpose.
Enable automatic backup is using AWS backup service with default settings. It is recommended to manually configure AWS backup for EFS based on your needs.
Life cycle management is disabled. Because we don’t want our application
files to be archived.

Step 3: We have selected the general-purpose performance mode. Once EFS is created, we can’t change the performance mode.
Choose the performance mode as per your needs. ( Ref : https://docs.aws.amazon.com/efs/latest/ug/performance.html#performancemodes )
We have selected the Bursting throughput mode. Choose the throughput mode as per your needs.
Enable encryption of data at rest is recommended. Our data will be encrypted in AWS EFS storage.
Tags are optional but it is recommended.

Step 4: Select the same VPC as our instance configured. We have selected the default VPC. Our instance launched in a default vpc.
Select all the subnets. We are going to launch EC2 instances in all Availability zones by using Auto Scaling. So We need mount targets for all the Availability zones.
Select the appropriate Security groups. In this, we are going to use the newly created security group which used in our EC2 instance.

Step 5: File system policy is optional. Select or create a policy based on your needs. In this, we deselected the policy.

Step 6: Review the EFS resource and create the File system.
In this below screenshot we can get the details about which option we can edit and which can’t after the creation of EFS.

Step 7: Our EFS is created and available now.

Steps to Attach EFS Volume
Step 1: Log in to the Linux server and update the apt-cache.
Command : # apt update

Step 2: Go to AWS EFS Console and select the appropriate File System and click the Attach option in the top-right corner.

Step 3: Select the Mount via IP option and appropriate Availability Zone.
Copy the below command which is needed to be executed in the Linux server.

Step 4: Go to the AWS EC2 Security group console and select our Linux Server, the security group.
In that security group, Edit the inbound rules and allow all traffic to the same security group.
So that Our EFS and EC2 instances can communicate without any issues.

Step 5: Back to the Linux server, We need to install the NFS Utility and mount the EFS.
Command : # apt install nfs-common -y

Create a directory named /var/www in the Linux server.
Command : # mkdir /var/www
Note: We can create any directory.
Modify and execute the command copied from the EFS console. Now our EFS is mounted in the /var/www directory.
Command : # sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 172.31.20.56:/ /var/www
# df -h

Step 6: Edit the /etc/fstab file and add the below lines to mount EFS permanently.
172.31.20.56:/ /var/www nfs4
nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0

Thus the creating and attaching EFS Volume in Linux using Private IP done.

Srikanth