Host your personal site on AWS EC2 Instance | EC2 Instance | Demo | Website Hosting | Web App on EC2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome back to my channel in this video i'm gonna teach you how to host your own personal website on an amazon ec2 instances right so first we need to create an ec2 instance in the aws console okay so let's jump right into our aws console and create an ec2 instance so let me go to amazon console so this is my aws console so to create an ec2 instance search for ec2 so select ec2 [Music] if you see right now there are zero instances running let us create one all right so click on instances so let us click on launch instance here are few configuration that you need to set up before creating the ec2 instance okay so let us walk through them one by one okay first thing you need to provide a name so i'll give the name as web hyphen server you can give your own name so this is a name tag that is getting attached to this particular web server okay so i'm naming this as web server select the os that you want so for example there are multiple os types that you have but i'm good with amazon linux as this is coming in free there okay so i'll select amazon linux and this supports 64-bit and 32-bit so i recommend you to go with 64-bit okay so also make sure that you are using under free tier if you are not paying as you go okay so select the one that you are using for free okay so i am going with amazon linux 2 and that is available for free okay next is again instance type you need to select the one that is free for you if you are not paying all right so i am going with t2.micro and even i can go with t1.micro but i feel that this that instance type is not uh you know supporting the one that the activity that i'm presenting today so i'm going with t2.micro and to log into this ec2 instance you need a key pair all right so if you have already created it go with the one or else you can create new here if you do not know how to do this steps i have explained in detail all the steps about creating an ec2 instance in a separate video you can find that in aws playlist you can go there and watch that video alright so i'm good with the network settings so i'm allowing ssh connection all right so from everywhere okay so i'm good with that so these are the things that i need to uh fill in before creating an asus2 instance i'm good with this let me click on launch instance so it says success let's wait for a couple of minutes so i think it will take two or three minutes to spin up a virtual machine or ec2 instance and the instant state should change to running and the status check should be two by two okay so we'll meet once the instance is running and the status check is passed all right now if you see the same ec2 instance that we created is running the state of the instance is running and the status check 2x2 past okay so if you see the details of the virtual machine or an ec2 instance it is like this okay so this is the key name that we use and this is the launch time and these are all the things that we selected all right so if you see if you still want to see the summary of this ec2 instance you can you know open up this and check this box and if you see all the details will be present here okay so this is how you create an ec2 instance the next step would be to connect to this ec2 instance and host your website so to connect to your ec2 instance we have many different types and i am going to follow ec2 instance connect method so if you if you are not aware there are multiple ways on how you can connect to this ec2 instance so if you do not know please watch my other video so i will drop the link to the other video in the description box below you can go check that out and then continue here all right so i will follow the first method instance connect method okay so to connect click on connect here so select easy to instance connect and click on connect [Music] [Music] all right now i'm in my ec2 instance so i've logged in to my ec2 instance right now all right now let us start the hosting of our website so i have i i have not written any code right so what i did is i went to this website and i found a beautiful website so i'm going to use this as my personal website and host it on the ec2 instance okay so let's see how to do it okay so after connecting to easy to instance you know change yourself to a root user okay by this is the command sudo su hyphen enter so now you are the root user so first before installing anything just update the system first so the command to update is yum ins m update iphone y okay so m update hyphen y so this will take a couple of minutes to get the system updates right now if you see the system is getting updated all right the system got updated if you see it says complete okay so the next thing that we need to do is to install httpd all right so that is the web server so to do that run a command let me clear the screen first run this command yum install hyphen y hd t pd httpd okay hit enter so it will download all the packages and it will install the web server okay so if you see complete all right so let me clear the screen again okay so now what i'll do i'll check the status of this httpd okay to do that so we have a command called systemctl status httpd if you see it is inactive so let us enable this one at the end but till then let us you know create a directory and name that as temp let us get into that folder okay so now what i'll do i'll get the zip file of this one this website so this is the website that i'm going to you know use this is available in this one freea css.com so you can also get any of the sample website from here and host it on ec2 instance okay so now i'm hosting this particular website to copy the link so just right click copy link address okay go back to your ec2 instance there is a command to download it so the command is wget and paste the link that you copied okay so wget and the link that you copied it will it should be a zip file okay so hit enter it downloaded it okay so let's check if it is available hyphen ls hyphen lrt if you see complex dot zip is present okay let me clear the screen first and rerun ls lrt so this complex dot zip file is present first let us unzip that okay so the command is unzip complex dot zip okay hit enter so it unzipped everything so let me do ls iphone lrt again now if you see there is a folder called complex and there is another zip file called complex zip okay so let's see what is there inside complex okay so i'll get into that cd complex okay so now ls iphone lrt you see these are the html files and styling javascript everything is there inside that folder so to convert this you know into this server into a web server you need to move these things these file html files and everything into a separate directory called slash war slash www slash html okay so let us move all the file from here to that particular directory okay first let me clear the screen the command is mv star move star star means move cop move this entire files that are present in this directory to destination directory is war www slap slash again html and slash enter now let's go into slash var slash www slash html ls hyphen lrt now if you see all these files are transferred to war www.html okay so this is how you you know host a server on ec2 instance to check if everything is working fine let us do one thing let us copy the public ip address from here and paste it in the browser so if you can able to see the content then everything is working fine so if you see it is refreshing refreshing and it is keep loading that means there is some issue with your firewall so the firewall in aws is security group so let us check the security group let me go to security and open the security group if you see in the inbound rules i am just allowing ssh type of connection but this is a web server so if you see the site can't be reached that means we are we have not allowed http and https in the inbound rules or the firewall so let us add those rules here edit inbound rules click on add role add http so the port number is 80 as you all know and i'll allow from everywhere okay i'll just say web port okay let me add another rule again for https so you need to you need to allow both of them if https and https you are not present here you can add your custom port also so https port is 443 okay i'll allow from everywhere again and i'll say the same description web port and save the rules okay so now we have added http https and ssh now let us go and refresh if you see we are still facing the same issue so the issue is we have downloaded the web server but we did not start the service right so we installed httpd but we did not enable or start the httpd so if we remember let us check the status again if if by using the command systemctl systemctl status http so if you see it is inactive right so let us enable it first so the command to enable is system ctl again enable http now if you see it created a sim link okay so now let us start the service so the command to start is also similar instead of enable change it to start hit enter now if you check the status see the http is running now the http server is running now let us go back to our page and refresh it now [Music] now if you see the page loads without any error right so this is the html page that i got it from this particular website if you want you can also use the same template i'll drop the link in the description box below you can also use the same now if you go back to go and navigate to different you know pages you will be able to do that without any errors right so this is how you host a web server or a web application on your ec2 instance okay so that is it for today so if you like the video subscribe to the channel like the video and share it among your friends alright so do drop a comment on what you want to see next right so that's it for today thank you for watching
Info
Channel: A Monk in Cloud ☁️
Views: 105,566
Rating: undefined out of 5
Keywords:
Id: Islmm-LMu38
Channel Id: undefined
Length: 15min 52sec (952 seconds)
Published: Thu Aug 25 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.