How to create, mount on EC2 and use AWS EFS (Elastic File System)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to majestic dot cloud I am Laszlo and in this video I will show you how to create an AWS elastic fire system or EFS and how to mount it on an ec2 instance but before we do that let's see what EFS EFS is a fully managed NFS file system for use with AWS cloud services and on-premise the service is built to automatically scale to petabytes without user intervention the file system grows and shrinks as you add or remove files you only have to pay for the amount of storage you actually use also your data is redundantly stored across multiple availability zones in order to minimize data loss however it is still a good idea to set up a backup solution because you could for example delete files by mistake and in this case if you have a backup then you're able to recover those easily it is also important to know that an EFS file system can be attached to multiple ec2 instances now I will do a short demo in this video but let's see what I'm going to do first of all I will create an NFS filesystem I will create two ec2 instances I will then configure the security group for EFS access and then mount the same elastic filesystem on both ec2 instances on the VAR dub dub dub HTML then we will install Apache web server and we will configure it to serve the VAR dub dub dub HTML as a simple static web site and in the end I will configure one of the instances or both of them to automatically remount the file system upon system reboot using the et Cie fstab [Music] configuration file so let's start if you didn't use EFS before this is the screen that we you will get from AWS and here you have the option to create your first file system and I will click on this option create file system you need to select the V PC in which one you want to create your file system I will choose default as this is the only one in this account here you can create the mount targets for each availability zone and AWS offers you some automatic options here I will choose next step here you can set up things like the tags lifecycle management because EFS comes with built-in lifecycle management and in this way you can set up some rules for what will happen with your files after a certain amount of time then you have the throughput mode which can be bursting or provisioned I will keep it to bursting you can learn more about what these are by clicking on this link here performance or mode I will keep it on general purpose and I will not enable encryption at this point so on the next step we also have some client access options policies and stuff like that but I will leave here the default stuff and then I will have this summary screen and we just click on create file system and usually this takes a bit of time not that much but yeah so it's now ready the meter size is 6 claw bytes this is my file system it has this file system ID this is important later and we will mount fire system and here it's still creating the mounts targets so we will wait a bit and continue then actually we can go and create our ec2 instances I came over to ec2 and I will click on launch instance here I select Amazon Linux ami little micro it's fine I want to launch two instances here everything will be the default on security groups I would want to use my existing security group and then I will use my new keeper launch instances so these instances will launch and then we will go login you SSH and mount the elastic file system we created previously my instance is finished launching now I will connect to each of them the first one here I will copy the IP address and I will use git bash to connect SSH PC to user and I will paste the IP and it should work yes now I will create the directory which I will want to set up as web root and as EFS mount point and that will be VAR dr. dot html' oh I have to use sudo okay so now it's that's done let's go and see the mount instructions here on this screen on EFS you see the Amazon ec2 mount instructions from local V PC if you click on it it represent you with some mount instructions and because I'm using on Amazon Linux ec2 instance I only need to install the EFS mount helper and the command is here if you don't use the EFS mount helper you can use an FSO Tio's but this is the easier option the first one so let's go back here and install EFS O'Toole's okay so it installed now before we mount the filesystem we'll go back to ec2 and on the security group which is attached attached to the instances this is the default one I will need to create an inbound rule for NFS and basically here I will add a rule for NFS and the source will be the security group itself so the default security group let's save it okay now I should be able to mount my PC to my EFS filesystem and here I have the instructions for the EFS mount helper I will copy this part here because this last part is the directory where you want to mount it and there I want to use the different one let's paste and here I will want to use VAR w dub HTML and it should be as easy as that ok now it's done I will now go and create an index file there so let's go to cd4 of the web HTML let's clear the screen and you should touch index dot HTML no I should use pseudo okay so now I will edit it and let's go to insert mode and I will say here hello from the FS and save the file let's see if it's saved saved okay now I will install Apache install httpd yes sorry I forgot sudo yum install ok I will start the to those service httpd start ok now if I go back and copy my IP address from here and I paste it in a browser I have a webserver walking here on this IP address of the first server which has hello from EFS so this index.html that we've created here is stored on the EFS filesystem now we will go and mount the same file system on the second instance and for that I will first copy the IP address and let's go here I will use SSH to login to this instance as well okay now I will create the directory we need okay i've created it and now i want to mount the filesystem there let's copy this command and go back here and also specify that we want this file system to be underworld dub dub dub HTML oh i forgot to install EFS utyos' so this happens if you forget it okay so let's try the command again and it succeeded let's change directory to world of HTML and if I issue this command I can see that I already have an index.html here and let's see what's in this index.html you can see it's hello from EFS so this is the same the same file system as on the other machine let's just demonstrate that again by creating another file this will be index.php for example and if i go back to the other window on the other server if I issue this command then see I have the index.php so they share the same file system now I will also copy the IP address again and open this one again and oh I don't have a passion start let's install a passion okay let's reload and I have also hello from EFS I have two servers serving the same the same content from the same elastic filesystem now in a real life scenario you could put a load balancer in front of them and served the content from the same elastic filesystem using multiple servers this is a good scenario and probably I will do a video on it sometime in the future on how to set up WordPress on an EFS file system and serve it you know highly available setup but for now let's go and also set up the instances to automatically remount the file system upon reboot because right now if I reboot this instance this mount command that I have issued here this one will lose its effect I would need to come in and issue it again but I don't want to do that so what we want to do is edit the following file so sudo V DC fstab and here we have already have some options but we will add another one so let's switch to insert mode and add here the following let me make this smaller so I can see the file system ID because that's important so it will be like this FS and E 3 3 7 D 2 6 string this one here this is my file system ID and then this and also I want to specify the directory where I want it to be mounted also what type of file system it is and some additional options that are required here okay so this should be it let's save this one and now let's reboot this instance and see if it works this is the first one instance state reboot yes reboot okay so it went down for reboot I will wait for a bit and resume the video when it restarted let's connect to the instance and I'm now connected and let's change directory to var dub-dub-dub HTML and issue analysis and you can see that my file system is mounted because if it were not mounted I wouldn't see these these two files here so basically this is it this is how you create an EFS file system how you mount it on in situ instances and how you configure it to be automatically mounted on the file system open system reboot and then yeah I guess this is it I hope you liked the video if you did please subscribe to the channel give it a like and share it and I hope to see you in the future video have a great day
Info
Channel: Majestic.cloud
Views: 2,506
Rating: 5 out of 5
Keywords: AWS, EC2, EFS, Elastic File System, NFS, Storage, automatically remount, mount
Id: zVInw-QkJN0
Channel Id: undefined
Length: 18min 1sec (1081 seconds)
Published: Tue Jan 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.