AWS Projects for beginners | Deploying End to End Website on AWS | Intellipaat

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone welcome to this session on deploying an end-to-end website on aws today in this session i will be taking you through how you can basically deploy a website which will be also interacting with databases and a service called s3 on aws okay so without any further ado guys let's go ahead and get started with this session so let me first tell you what we are basically going to deploy today so guys uh we are basically going to set up something like this today so we as a user we will try to go to a url like this www dot aw and this domain should basically route us to our website okay now what will our website be able to do let me quickly show you right so i have a website on my localhost right so let me see if i can show you that website so one second let me go ahead and launch this website once okay now in order to launch this website what i'll have to do is i will have to install some packages so let me go ahead and install them uh so i will have to install uh buy mysql let me see if this makes it running okay so [Music] what we have to do is we have to deploy this website and the way we are going to architect our website is going to be something like this okay so first of all we will configure this domain to connect to our virtual server that we are going to launch right and the way to do that would be using the route 53 service on aws okay now our website will be able to upload objects onto amazon rda uh sorry onto a you know a storage service called s3 right so our website whatever images that we are going to upload using our website it will be uploaded to uh you know an object store called s3 from where you will also be able to see that the objects are getting uploaded and at the same time the entry for this will also be stored inside a mysql database which is going to be inside amazon rds okay so guys this is what uh we are going to deploy today and we are going to go ahead step by step so first let's go ahead and start by setting up our website so first let's uh you know deploy a database a mysql database on aws now the way to do that is by making use of a service called amazon rds right so let me first go ahead and switch to my aws management console okay so guys this is what my aws management console looks like and now what i'm gonna do is i'm gonna go ahead and click on ec2 uh sorry so we are going to deploy our database first so let me go ahead and select rds okay so you just have to type in rds over here and it will basically make you go to the rds service now once you are over here this is how the rds dashboard looks like once you are over here you will have to click on something called as create database just click over here and now what you will have to do is you will have to click on uh so this is standard create this is going to be automatically selected for you in the engine options you will have to select mysql so let's select that and now with mysql selected just scroll down and you can select the mysql version okay now you can select any version that you want i'm going to leave it at default which is 8.0 and scroll down to select the template in which we want to deploy right now since we are practicing uh on our aws account what i recommend is for you to basically deploy everything in the free tier so just select free tier over here right and then scroll down and once you have reached here what you'll have to do is you will have to go ahead and specify your database uh how will you basically identify this database server okay so let's say we give this name to be employee database because our website is basically going to be an employee website uh about how we can basically upload data of an employee onto uh you know our website this will be about that so let's name our database also employ right and now let's go ahead and specify the username and the password okay so let me specify the username as intellipart and let me specify a password as well so let me go ahead and specify the password okay so i've given a password and now what i can do is i i don't have to choose this because uh this is basically which kind of machine do you want to launch so the machine that we want to launch is going to be t2.micro itself so we are not going to touch this right because this falls under the feature and this is automatically selected for me when i choose the template as free tier uh above okay now uh the next thing that i might have to see is auto scaling so auto scaling basically means if you get a lot of load on your website should your server become uh two or three instead of just one so we do not require that as of now and i think it is a little advanced for you as well for this class so we are not going to select this option okay uh then which network do you want to deploy it in so we are basically going to deploy it in the default network for now so we are not going to touch this and it is going to be a password authentication which is which is fine for us uh is it publicly accessible so yes it will be publicly accessible which means it will be available on the internet for us to work with okay so we have selected yes over here and next we will have to change nothing else we can just now click on create database and my mysql is now basically getting automatically created now if you would have noticed if you were to do this on your own and by that what i mean is if you were to not use any cloud provider and if you were to deploy a database server you would have to do a lot of things so first of all you would have to launch a server then you would have to install mysql manually on it right and then configure it to basically allow internet connections from outside but that is not something that you have done for now right what you have done is you have just gone through a dashboard where you have selected the right options and then you have just clicked on create database now whatever is going to happen now is automatically going to be managed by aws and that is why uh this service the service which you are using which is amazon rds is a managed database service which basically means everything from deployment everything from installation of the database everything is taken care of by aws and we don't have to do anything in it okay so now this is getting set up so let's wait for some time and make let's let's hope this gets set up soon uh if we come back to our slides uh what we need to next figure out is our s3 bucket where our data is going to be uploaded and now what we are going to do is we are basically going to uh you know create a bucket for us where all our data will be uploaded so coming back to my aws management console what i can do is i can just search for the s3 service over here click on it and now i will be taken to a s3 management console okay now on the s3 management console what i'll be doing is i'll be creating a bucket so let's create a bucket and let's call it uh let's call it employee let's call it ad employee okay and this will be in the ohio region usc 2 which is great right nothing else we are changing we are just clicking on create bucket now it's very important to take note of where your bucket is being deployed so our bucket has been deployed in the ohio region and if you talk about a rds that will also be deployed in the ohio region itself so we can check that quickly if you go to rds again how can you check which region you have basically deployed a resource in uh you can check it in the url it says usb2 or what you can also do is you can just check the region over here at this section of your aws console it says ohio over here as well all right great so now we have created a bucket we have created a database right and now what is left is to deploy our server which is going to hold our website basically okay so let's uh create a server as well so let me type in hc2 over here click over it and let's click on running instances so here what i'll be doing is i will be creating a server and the way i'll be creating it is i'll be cleaning launch instance and what i want to do is i want to basically deploy an ubuntu server so i'll be selecting ubuntu over here right now in ubuntu uh what is the processor that i want to choose from my server it will always be free tier eligible so i'm gonna choose that click on next uh then how many instances do we want to launch we just want to launch one instance because i want to show you how you can set up a website okay so we're not going to change anything over here and rest everything also you will not change anything just click on next uh this is how much hard drive will be given to your system so we will leave it at default it will be 8 gb we'll click on next now let's click on configure security groups now here you will have to select the default security group it should already be there when you first create an account just select this and click on review and launch okay now you can review all the settings that you want to uh to basically check and if everything looks good just click on launch and over here you can either create a new key pair or you can choose an already existing one so how to create a key pair how to do uh how to convert it how to set the right permissions everything has been talked to you in the previous session which was at 5 30 so that was deploying virtual servers on aws right you can just refer that as well to see how you can do it over here i'm going to uh you know a key pair which i've already defined which is basically going to be uh mac ohio okay so i'm gonna select this key pair acknowledge that i have it and click on launch instances so now my ec2 is getting launched so it will take some time meanwhile let me see if you have any questions uh so prashanth is saying you have shown the example of deploying a website is it possible to deploy components and compile my process in cloud itself so prashanth i think what you mean by this is deploying microservices and cloud so yes prashant that is possible uh to deploy too right uh the way to do that okay there are multiple ways you can do that i mean if you if you're deploying a micro service i don't think you should deploy it on one server there are a lot of other services in aws as well which you can make use of for example you have something called as elastic container service so if you are a little more advanced in aws and understand the services you can actually deploy it over there as to okay so now what i'm doing is i have just launched uh you know my instance and let's check the status for this instance so first of all let me name this instance something so let me put it as hayman's hyphen project okay so my instance is now uh in the running state which basically means it is all good i can just refresh and now we can try connecting to our machine okay so let's select the machine uh let's select the ip address of this machine and now let's try to connect to it now how you can connect to it you can basically connect to it using a terminal so what i'm gonna make use of is my terminal over here okay and let me go to the place where i have saved the key published server right so the command is ssh hyphen i dot slash my hyphen ohio dot pem the username for my server is ubuntu and this is the ip address so now i'm connecting to my ec2 server it's going to ask me whether i trust this server so yes i do and now it will allow me to connect to the server great so i've connected to this so next thing that i'm gonna do is i'm gonna go ahead and uh you know connect to my rds first to see if everything is working fine or not from the network point of view okay so how can we connect to our rds first we need to deploy a mysql client on this machine which will help us to connect to our rds machine so how can i install the mysql clients let me go ahead and update this machine first so the command would be sudo apt-get update it this will update the machine okay so machine got updated and now what i'm going to do is i'm going to install my sql client so sudo apt-get install mysql hyphen client okay this is going to take a while to install meanwhile i'll just take up questions so now many saying how to do with this with windows so naga many if you want to ssh into an instance uh you will have to download a software called right so i showed that in my previous session uh which was at 5 30 uh you can just refer that after this session as to how to connect from windows to a server that you can connect to or you can just search online as to how to connect with the software called putty to a linux instance that you have deployed on aws okay so i hope that answers your question all right so now mysql client has been installed on my machine uh on my aws machine and now what i'm gonna do is i'm gonna try connecting to my rds now for connecting uh since i've installed my sql client the command would be mysql hyphen h h being the host name of my database that i want to connect to and for connecting to it i will just go to my browser and go to the rds service again so what i need is the rds url so let's go there okay and now we can just select the database instance that we basically want to connect to so i can just click on the database that i deployed earlier and this is the url that i am looking for to connect to my instance okay so i'll just select this and let me see if any other information is required from my site okay everything else looks good so now what i'll do is i'll just enter the url over here so mysql hyphen edge the url then the username which is in telepath and then the password so let me enter the password as well and as you can see i have successfully connected to my rds and i am on the mysql shell now okay so before i move on let me see if there are any other questions so nagamoney is saying other than using for windows what are the other options [Music] linux machines from windows other than putty you can also use git bash uh other than footy you also have something called a super putty which you can also it's a premium tool which you can also use into machines so saying we configure this on linux system instead of ubuntu the command that i'm writing right now if you want to do it for linux i think you will have to google the commands so other than that god all right so now that i'm inside the mysql shell guys what i'm going to do is that i will go ahead and see if the database is actually initialized on this server so i'll just type in show databases and there's no database as of now deployed in this server so what i'll do is i'll type in the command create database employee so database is now created and now i will have to create a table inside employ where basically my uh you know information is going to be stored okay now what all information do i need to store in this table that will be clear uh from our website right so what we can do is uh we can just check the code of our website and understand what all is required to enter uh in our website so okay in our database so we need a column called employee id first name last name uh prime skills location and employee image file okay so these are the things that we need uh to enter i think this is not required because this is the sql query and here i just have five things that i'm inserting in sql so what i'll do is i'll just select these five options and this is what i'm going to insert in my database so i can just go ahead i can create uh table employ and now i can just specify the column so first column is emp id let's give the data type to be as varcat and the value to be as 20. after emp id the next is first name so let's give f name over here and the value would be work 20 then we can give last name so last name again would be 20 i'm just giving the default value as 20 characters you can modify it if you want uh primary skill so we'll give the primary skill to be where care again and the range would be 20 characters too and then the location so this would be the last column for our table and here also we'll give 20 characters okay it says no database selected so i'll just select use employee this will change our database and now i can just copy the same syntax okay it says i have a error so let me just check what the error is okay so i guess there are arrows which are causing the problem so let me just copy it one by one employ then emp id with the comma then fname then last name then primary skills which is this and then the location okay so my database is now created uh successfully so if i type in show tables it's showing you that the employee table has been created great so now that my employee table has been created i can actually go ahead and start configuring my website to work okay meanwhile i'll just check if i have any questions okay no more questions let's go ahead so now what i'll be doing is i'll be configuring my code so let me just exit from mysql shell and let me exit from the ec2 server also okay so i'm back to my local and in my local let me go to the code where basically i have my website now first let's try to run the website on our local system and then we will try to deploy it on the aws management console okay so uh let me open it in sublime text our code here it is and here i will have to first configure my website so here i will be putting the uh hostname of rds so let me get that hostname is nothing but the endpoint so let me copy it so this is the hostname next thing that i'll be doing is i will be copying the username so username is nothing but in telepath then i'll be specifying the database so the database would be employee and the bucket name uh is uh emp hyphen ad if i'm not wrong so let me just go ahead and verify that uh the bucket name has to be the same as what you have created in s3 service so it's called add employee so let me specify the same in my code as well the bucket is called add employee right and then we will be specifying the region so region is us east hyphen two okay so guys this is uh you know the uh configuration that we have to do now i also have to specify the password over here so password would be in teleport one two three and don't worry i will be deleting this database later so you guys can be rest assured that this is not going to be causing us a problem okay so now what i can do is i can go back to my code and let's see if we can deploy this website on a local okay so website is on our local now right so let's see how the website looks like so if i go to localhost okay so this is how my website is going to look like guys okay and when i enter the information over here it has to go and now be stored in my mysql database whatever information i'll be specifying over here that information will be going ahead and stored in my database okay now uh what i can also do over here is uh now i will be making it available not on localhost but actually on my ec2 that is my web server so let's see how we can do that so first things first i will actually have to go ahead and close this application right and now let's uh save everything so i will be pushing it to github so let me stage everything on my local right and now let's just go ahead and push it so what i'll have to do is i'll have to create a remote repository so let me go to github.com now on github.com let me create a new repository and let's call this repository as uh aws hyphen live okay it will be a public repository let's click on create okay so repository has got created let me add this in the origin added and now let me push it to my website uh to make it all right so my website has now been pushed onto github so i can verify that by refreshing over here and i can see that i have everything uploaded on this okay so let me check config.py as well yes so this also has all the values great now what i'll be doing is i will be going ahead and uh pulling this code on my ec2 server so let's see how we can do that let me ssh into my ec2 again okay so i'm inside my ec2 now and let me clone the code that i have pushed onto my github okay so now i have uh basically gone in uh i have copied the code onto my ec2 machine and now i can go ahead and deploy the code over here okay so i'll just go into aws hyphen live and now i will uh first install python 3 so what i'll have to do is if you can i'll be sharing this github with you i think a lot of people of you might ask this question so surish is saying outside network can connect automatically all we have to do manually so for this right now i have configured everyone to connect you don't have to worry right and what i'll do is i will just put this github link on the chat so that every one of you can have a look at the code okay so i've done that and people on youtube you can actually just go to this link which is which you can see over here and then you will be able to see the code as well okay now uh that we have the code with us on our server uh yeah i was showing to the readme so according to readme we will have to install all these things so we have already installed mysql client you can find all the commands over here which have to be executed on your server right now we will have to install python3 we'll have to install flask we'll have to install pi mysql and we'll have to install boto3 so what are these commands so basically uh python 3 is the uh you know is the language that we have coded our website in so this is the language that it has been coded and we'll have to ensure that it is existing on the system where we are basically uh you know running the website flask is a web framework which basically helps python to uh you know go ahead and uh publish a website onto that server and pi mysql is basically a library which helps you know the website to connect to a mysql server then you have something called as moto 3 so voter 3 are the aws sdks that are developing kits which basically help you to connect to you know your s3 service where you will be uploading your files okay so these are the things that need to be installed so let's go ahead and install it and for that what you'll have to do is just go to your server and first let's install python 3. so sudo apt-get install python 3 so python 3 has already been installed next thing is that you need to install pip3 so sudo apt get installed with three three okay so it has to be by thin three hyphen pip okay so now it is being installed on this server as well so it'll take some time let me see if you have any questions okay no question so far okay i believe everyone is following along in that case if there are no questions uh all right so now let's wait for this installation to get finished so what we are installing right now is pick so pip is nothing but a package manager for python which helps you install any libraries that your code might need so it's got installed and now what we can do is install the packages that are required so pip3 installed by mysql and we need boto3 that will automatically be downloaded now for the code and we also need to install class so pip3 install flask okay so that also has been installed now uh what if we try to you know connect to the website uh the website will get launched successfully but we will get an error let me show you how to solve that error okay so now my website got deployed so now what we were seeing on the local host if you go to the ec2 that we deployed which is this and if i try to go to this ip address you can see on this ip address i am now able to see this website but let me show you a problem that you might get so let me enter my information uh primary skills let's say it's aws location let's say it's india now we choose a file which we want to upload to s3 let's choose an image which we can basically upload let's click on update database so as you can see you got an error which says unable to locate credentials okay and if you go to your s3 management console and inside your bucket that is add employee uh you will not see any object or any file uploaded over here now how you can solve this particular problem now in order to solve this problem what you have to do is you will have to basically give your ec2 instance or your server access to basically upload data to s3 now how you can give access to your aws instance uh first of all your question should be why does your server need access to upload data to s3 so uh on this server we are running some code and that code is trying to interact with the aws s3 service okay now in terms of when you when you're connecting with rds you have passed in a username password so it all it's all good it has got the authorization and now it's able to basically enter information inside the database but uh let's now assume that instead of uh let's now assume that uh what is the authentication that we are giving for connecting to our s3 service so there is no authentication right so for giving the authentication to your s3 service what you have to give is an im role to your instance and how can you do that so there is a service in aws which is called iam select this service and in the service now i'm gonna go to users it's not user sorry i'm gonna go to roles and i am now going to create an admin role for my aws account okay so when i click on create role it will ask me who which service is this role for right so this is a role for my ec2 service so i'll select that okay so once you have selected ec2 next it'll ask for permissions so what kind of permissions do you want your ec2 to get so when you say permissions now you're giving access to different services in aws okay now for this demo sake what i do is i just select administrator access that is this ec2 can actually interact with any service in aws okay we'll give it admin access we'll click on next and we'll click on review and let's give this role a name let's call it as aws like okay and now let's click on create role so now the role got created and now if i uh go to my ec2 dashboard now i will have to select my server this is my server heyman project i will click on actions and now i will go to instance settings okay and in instance settings i will go to attach or replace i am role i'll click there it's right now is not having any role now i'll give it a role which is basically aws live which is over here and select it click on apply and the easy to now have the correct role to basically upload data to s3 now let's see how we can do that so right now i'm getting this error that is unable to locate credentials so what i'll do is i'll just try to connect to the website again enter the same information so now let's change the employee id uh let's enter uh john doe primary skills either do s location let's say it's india image let's choose an image that we want to upload this is the image that i want to select let's click on update database now so now me my image is getting uploaded and as you can see it says following image has been added to the database right now if i go to s3 and if i hit on refresh over here you can see a file has been added over here and this is the exact file that i chose which needed to be uploaded to s3 at the same time if i try to connect to my mysql so let me connect to mysql from my localhost so let me just check one simple thing guys give me one second okay now let's try to connect to our rds so my rds has this url let me pass this url this is the username let me pass in the password okay let me use the employee database and let me select star from employ now so as you can see earlier i entered heyman sharma aws india but at that time my image did not get uploaded because the credentials were not there uh this information got inserted and similarly my john doe data has also been inserted successfully now let me do a one thing guys i'll just give this ip address to you and all of you can try entering your information here and this information will then uh be reflected in my database so i'll just give this ip on the chat on my go to webinar and you can go ahead connect to this website and enter information over there and then you will be able to see your data on the mysql also okay so once you've done that just type in yes in the questions and then i will just go ahead and show you guys that your image also has been uploaded to s3 and your data is also being reflected on mysql okay while you do that now let's move on to the next step so this part of my architecture is done my ec2 is now connected to rds my ec2 is now connected to s3 we have our website deployed over here now let's see how we can basically route a domain like this to my ec2 server so right now we are trying to connect using an ip address right but i do not want to connect using an ip address what i want is i should have a domain i should have a proper domain which can be used to connect to my website now how can i do that so for doing this what i'll be doing is i will be going to a service called route 53 in aws so let me just type it out this is the route 53 service okay so and here we will have to create a hosted zone okay um let's create a hosted zone click on culture john type in the domain name now this domain name guys uh has to be purchased by you guys okay so if you want you can actually purchase a domain over here right it says a dot-com account is twelve dollars uh you can just check all the things over here and any domain that you want just enter the name here it will check if it is available or not and you can purchase it straight from the aws management console or for demo purposes what you can also do is you can create a free domain so i have created a free domain from a website called freenom so let me show you how that website looks like so just go to freenom.com uh sign up yourself over there and then what you can do is you can create your own domain name right all you have to do is once you're signed up signed in click on services click on register a new domain okay so when you click on register on a new domain it'll basically just ask you the domain name that you want to you know basically avail for free so let's say i want to avail uh hello world and teleport let's see this is the domain that i want to select so i'll just click on check availability and if this domain is available it will tell me that it is free and it is available right now i'll just click on get it now it'll say it's selected i'll check out uh again it'll be valid only for three months guys remember this if you're buying it for free it will be valid only for three months click on continue and click on complete order once you have agreed to the terms and conditions so now uh once you get to this order confirmation page it basically tells you that you have bought this domain successfully now go to services click on my domains and you will be able to see your domain over here this is how you basically subscribe to a domain on uh free norm now what you'll have to do is you will have to select awa okay so now i already had a domain which i had followed the same process for right it is exactly the same in the same state i have not configured this domain to do anything i'll be showing you the configuration now okay so i'll be going ahead with this particular aws hyphen project dot tk let me click on manage domain and from here in manage domains i will have to go to management tools and i will have to go to name source once i am on name servers i'll have to select use custom name servers and then we'll have to fill out this information i'll show you how to fill out this information in a minute let me see if you have any questions okay naga money says he has entered some information okay now the money let's check if your information is there so let me see in the s3 service first if you have uploaded any files so yes there are some files being reflected over here right and now let me check in my database if i have any values so select start from employ and yes uh there has been an entry from for the name homemaker and there is also an entry for arjun so i can see two guys have updated their information great guys so you can see your information on the screen now all right moving forward uh now let's go ahead to my and let me show you now how to enter this information okay so now what i'll be doing is i will be going ahead on my route 53 management console and i will be creating a hosted zone so i click on create hosted zone and you have to specify the domain name over here now this domain name will exactly be the same as what you have specified in your free norm so i have my domain names as aws hyphen project dot tk okay we'll be selecting this click on create and then you will reach this screen on route 53. now these are your name servers guys that you see over here and these have to be filled out over here in free norm okay so let's fill these out so what i'll be doing is let's select these and select these name servers one by one so let's select the first name server copy it paste it here let's go ahead and select the second name server now copy it and paste it here select the third name server copy it paste it here similarly the fourth name server which is this so there are in all four name servers that aws gives you and you have to copy all the four in your freenom dashboard okay once done click on change name servers and your changes have been saved successfully now your free nom domain can connect to your route free router 53 service correctly great now you have to connect your route 53 service to your ec2 server that you have deployed let's see how you can do that so now you will have to click on create record set all right specify uh you know an ip address over here and that ib address will go basically here in the value so let's select our easy to ip address which is this let's select it and let's paste it in our route 53 so here is the ip address uh we will not enter anything in this field right and let's click on create so your record has been created similarly create one more record set enter www and enter the ipad same ip address over here and click on create again so you're entering two informations over here one is with www and one is without www okay and you have basically forwarded this to your ec2 instance ip address now if you go ahead and type in aws hyphen project dot tk on your browser it should take you to your website so all of you now you can go ahead and type in this url and you will be going uh be able to access the website that we have just launched so just go ahead and type in aws hyphen project dot tk on your machine so let me also put it on chat just type in on your browser and you should see this page that is visible over here just confirming the chat guys once all those who are there in the webinar on youtube also guys uh just type in aws hyphen project dot tk and then you should be able to see the website please confirm us in the chat so that we know that it is working correctly okay it is working for naga money others guys please try it out ramesh says it's not working for him okay ramesh just type in www also in front of it i think it should work out okay so with this guys we have successfully uh you know configured a website let me also try it in incognito once so that we know this is not something which is being picked up from my cache so aws project dot tk and then we'll type in www okay so on youtube i also see that jerry king is saying it's working great jerry king thank you for the confirmation and yes it is working in incognito as well okay so madhu says it's working uh ramesh says working with www okay guys uh you know in some time you can also access it on without www also because since it's dns sometimes you know the settings it takes time to be implemented across all the dns servers which are there the four dns servers that we defined every time each user does not connect to the same name server everyone is connected to different name servers based on the load which is there on the server after some time even aws project or tk will work okay so with this guys we have come to an end uh to our aws session right so i just showed you today how you can go ahead and deploy your own website end to end on aws uh without worrying about uh you know how you have to uh deploy your servers what settings you have to do so i've showed you each and every step in this video i have also showed us i mean shared the github on the webinar right so we can actually go ahead and you know pull the code by yourself and try this on your own too
Info
Channel: Intellipaat
Views: 83,969
Rating: undefined out of 5
Keywords: aws projects for beginners, aws project, aws projects, aws architecture project, aws project from scratch, deploying end to end website on aws, amazon web services project, amazon aws projects, multi tier architecture in aws, aws live project, deploy app on aws, deploying web app on aws, how to deploy website on aws, build aws architecture, build aws architecture from scratch, aws training, aws certification, aws course, intellipaat aws
Id: 7Gym2XVcA5A
Channel Id: undefined
Length: 55min 2sec (3302 seconds)
Published: Wed Aug 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.