How to Create AWS EFS(Elastic File System) and mount on EC2 instance

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome to linuxhelp.com for today's topic i will show you how to create aws efs elastic file storage and mount on ec2 instance amazon elastic file system provide a simple scalable fully managed elastic nfs file system for use with aws cloud service on-premises resources amazon afs is easy to use and offers a simple interface that allows you to create and configure file system quickly and easily it's a web serving and content management amazon efs provide a durable high throughput file system for content management system and web serving applications that store and serve information for a range of applications like websites online publications and archives so now let's move to the amazon aws management console so now i'm on my amazon console let's create two ec2 instances here go to the instance and launch instance i am creating amazon linux to mi i am creating t2 t2 microtype instance general instance here you will see this is a default vpc connection here i didn't create any custom vpc here and select the ability zone as south 1a now leave all the things as default setting okay now click to next step to add storage so by default storage size is 8gb now it's ok now click to add text i'm defining the name of this instance now i'm giving the name fs first and uh click next configure security group for the security group i will select i will create a new security group here using ssh 22 port range because it will take sh to control the instances from mercy so okay here's a launcher wizard2 remember this because we need to add this security group for our next instance also so review and now all the configuration and settings have been done now just remove all the settings here t2 micro eps only and protocol is tcp 22 port range okay now click the launch and choose an existing pair i am choosing as my efs sphere choose an existing pair of key selecting the efs now launch instance so it will take some time to active meanwhile i'm creating my second instance using amazon linux with the basic type of this d2micro from here also choose the default vpc connection here and select the subnet in the last instance i have selected subnet of ap south a now i'm giving here south 1b as the new ability zone and leave all the default settings here now click add ns storage it's okay and they give the name here as fs2 now click security group i will select the security group which i have given in last instance this one yes ssh or range 22 okay now review all the settings and configuration here it would be very easy and uh basic configuration all in all the instances here so now click launch and the key pair choose for the efs and launch stance so now i have created both instances here with all the basic configuration using the sh security group this instance will take some time to came up so meanwhile i'll go to my file system you will see file system in a storage section the efs so now come to the file system i will create a file system here efs the elastic file system it's not a standard storage as we have it in s3 uh it's a very clean and a very visible way of doing a sharing mechanism if you want to share your value many storage then you can use efs not s3 service okay so now let's create file system okay let's give a name for your file system i'm giving a demo name ability and doability regional i'm configure it's a reasonable because if you put one zone then it will only select single zone so i am putting as a regional and the life cycle management you can also define life cycle if i will not access last 30 days or 14 days then you can use this policy so that it will be relocate to any different storage space and you can also delete it so now we are using 14 days since last access performance mode is general purpose and throw port mode is bursting and performance mode is general purpose and you can use maximum input output that totally depend how the request coming to your storage part what we so we are for the demo purpose using only these things for the encryption setting uh you can also encrypt data at the rest uh as well as using uh kms keys so i'm leaving that part also okay so click next the second thing is the network access here this is the default vpc i'm selecting here and for the availability zones you don't need to select all the availability zones i am selecting only one a1b and leaving the 1c south 1c and for the security group one thing you have to mention that for the efs you have to select nfs security group i'm selecting the nfs here this is the efs and for this i am selecting this i have already created these nfs security zone i will show you how to create them okay so now ip address it's automatic it will take automatically so now click next file system policy click next and this is all the review setting review you see check all the cross verify all the settings you have done before so that's all and now click create so now my file system has been created with the demo name it will take some time to come up the file system state is now available okay so now let's go inside the file system go to the network you will check cross verify all the things the mount target state is still creating it will come up after some time it will take some time now my file system is now available here if you see here that file system mount target state is now available so now move to be my uh file system let's see demo here so now i'm going to take ssh from my system to my instance which i have created before now go to your receiving instance in the running instance section you will find that all these instance i have created before so using the ssh and i will use all my keys so first we will move to my download section which i have downloaded my keys and now i will take ssh control ssh hyphen i my keys name is c e f s dot spam now the username is easy to hyphen use now enter username you see to hyphen user and add the rate and now provide here your easy to instance public ip what is the public ips just copy from here this is your first ec2 instance public ip and this type yes and your launch in your ec2 instance now you are in your instance now i will install the amazon utils here using sudo vm install hyphen y amazon efs utils it will install all the package required and now now we will go to the documentation part in our file system if you move there you will see in your demo file system go to attach section it will show if you mount white dns you have to provide all these commands and if you want by ip you have to give this so i'm using this first of all i will create the efs directory there so go to your command prompt and create mkdir efs and ls if you do yes it's created now using this command we will mount our hardness layer we will mount there using this command it will mount at that location yes it's mounted if i using df51h you will see that the last section is containing 1227. it say 8gb and uh it is a mounted at the location of home ec to user efs so it's mounted here now go to your efs directory and if you do ls here there's no file create new file here touch hello dot txt now create touch file here you use ch hello.txt and provide some content in hello.txt file insert mode hello world write and quit file now it's okay now i'm going to my second instance and taking such from my system there i am opening my command prompt and go to the download section from there i can access my keys pair okay i'm taking sh hyphen i my keys name is efs dot spam username is c2 iphone user and at the rate now i will fetch my public ip for my second instance instances copy this public ip and provide it here okay now login give yes now you are in your second ec2 instance now first install your amazon newton's utils here first to give here sudo so now um install hyphen y amazon efs mutuals it will install all the packages now if you do ls here there's nothing file here so now mount or efs file system here with the same which i have shown there go to your file system pfs i'm just going to copy that command click attach and you will see this is the command you have to put to mount your file system create a directory here mkdir efs now give your mounts command it will mount there now if you do ls the efs is there go to efs directory and do ls you will see hello.txt file is already here because you didn't create file here but it's already here because i have already mounted my file system at different ec2 instance and i created the file at that location after mounting my file system here you can able to access your file from here also from different instance also so if i open my vim yes this is the same content hello world so this is the method how to create a efs on aws and mount it on your instances either they are in different availability zones or they are in same ability zones if you like it please subscribe to our channel and also to watch more tutorial please visit our website www.linuxhelp.com and if you have any queries mail us to support at linuxhelp.com
Info
Channel: LinuxHelp
Views: 2,219
Rating: undefined out of 5
Keywords: Linux, Help, EFS(Elastic File System), AWS(Amazon Web Service), EC2(Elastic Compute Cloud)
Id: rsU-UnAtgBM
Channel Id: undefined
Length: 16min 0sec (960 seconds)
Published: Fri Mar 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.