Рет қаралды 9,067
In this tutorial, you'll learn how to mount EFS file system to multiple EC2 Instances in AWS.
-
Facebook: / gokcedbsql
-
Video Transcript
-
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to mount an EFS file system on multiple ec2 IN AWS. Let's start by navigating to the ec2 dashboard and then clicking on security groups.
Click on create Security Group then give it a name and a description. I'm going to call it my web server Security Group and add an inbound rule for SSH from anywhere. Hit create then create one more Security Group for the EFS file system.
Here, I'm going to add an inbound rule for NFS from my web security group that we just created. Hit create then navigate to the EFS service. Click on create file system then give it a name.
Click on customize. Here, I'm going to disable automatic backups and transition to IA. I'm going to disable encryption and leave everything else to default then hit next.
For Mount targets, I'm going to select two availability zones US East 1A and 1B. For security groups, I'm going to select my EFS Security Group then hit next create. Let's go back to the ec2 dashboard and launch two instances.
Give your instance a name, select an Ami then click on edit in network settings. I'm going to select US East 1A availability Zone and my web Security Group then hit launch. Hit refresh and you should see my server 1A in a pending state.
Let's launch one more ec2 instance called my server 1B in US East 1B availability Zone. Now, let's connect to my server 1A using instance connect and install the Amazon EFS utils package. Use the mkdir EFS command to make the EFS directory then navigate to the EFS service.
Click on your file system then hit attach. Copy the EFS Mount helper command and paste it into the terminal. Replace EFS with Slash EFS then hit enter.
Give it a few seconds then run the DF hyphen H command and confirm that you see the slash EFS mount. Use the CD command to go inside the EFS folder then create a test directory. Leverage The CH's own command to change the ownership of the test directory to ec2-user.
Now, you should be able to go inside the test folder and create a new file. Say test.txt without the Sudo command. Next, let's connect to my server 1B using instance connect and install the Amazon EFS utils package.
Just like before, create the EFS folder and mount it using the mount EFS helper command. Now, if you go inside the EFS folder, you will find the test directory and the test file that we created from my server 1A. There you have it.
Make sure you like, subscribe, and turn on the notification bell. Until next time.