File System in the cloud using Amazon EFS
AMAZON EFS (Elastic File System) :
Amazon Elastic File System is a cloud storage service provided by Amazon Web Services designed to provide scalable, elastic, concurrent with some restrictions, and encrypted file storage for use with both AWS cloud services and on-premises resources.
HOW IT WORKS :
Amazon Elastic File System (Amazon EFS) automatically grows and shrinks as you add and remove files with no need for management or provisioning.
HOW WE CAN USE IT :
We can use EFS file System as a common data source for workloads and applications running on multiple instances
TASK AVALIABLE :
SOLUTION :
1.) Now we will create security group after checking instances
NOTE : (you can add your default name, description, & VPC according to needs , I'm performing AWS cloud quest task soo I followed the steps given in the task)
After selecting the NFS as inbound rule you can create the security group and verify your security group name after creation of security group.
Concept behind this is (when we create Amazon EFS mount target we must attach security group. The security group determines which instances access the file system as NFS client, as shown in above pic)
2.) After creating security group search for EFS service in search menu and then click on (create file system) after that you will be forwarded to the screen as displayed above in the given pic
3.) In network access select your availability zone, subnet ID & security group & then click on next button on the bottom of the screen
In file system policy create your policy if you wanted otherwise click on next as it is optional
After clicking on next check all the setting in review and create window and then click on next present on the right most bottom of the screen.
4.) When the file system is successfully created click on the file system name highlighted in blue colour
After opening the file system name click on attach highlighted in orange color in the screen
Click on copy button as given in above pic and then click on close button
5.) Now go on services search for EC2 service
After it select your first instance and then click on connect as given in above pic
Then click on connect
Recommended by LinkedIn
6.) In Amazon Linux 2 AMI first type the given command to install the amazon EFS utilities
COMMAND: sudo yum install -y amazon-efs-utils
Then type the given commands
1.) mkdir data
2.) ls
3.) In third command paste the mount command which was copied in earlier
4.) cd data
5.) sudo bash -c "(give name of file acc. to you) >> efs-1-setup.log"
or
sudo bash -c "efs-1-setup.log"
6.) efs-1 mounted site A
7.) ctrl c
8.) efs-1-setup.log
7.) After it we again go to EFS service and open the file system name on clicking the file system name
Then firstly we on add mount target
8.) Again go to EC2 service and then select the second instance which we want to connect
Then again click on connect button and type the command in Linux AMI
Then type the given commands again
1.) mkdir data
2.) ls
3.) paste the link again which we copied earlier using EFS mount helper
4.) cd data
5.) efs-1-setup.log (if you can see that efs-1 is mounted then our first EFS is already mounted now we have to mount the second)
6.) sudo bash -c "efs-1-setup.log"
7.) efs-1 is mounted in site B
8.) ctrl c
9.) efs-1-setup.log
If you can see that (efs-1 is mounted in site A & efs-1 is mounted in site B) that means our both EFS are connected