AWS Class Recording for Wednesday 6/16/2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so good evening um before we start what we are going to do today um let's just try to remember where we left off last class so in the last class we we created our application load balancer right and we used the application load balancer to route traffic to the ec2 instance in our private subnet one and private subnet two another thing we did is the first time we create our application load balancer and we create the ec2 instance we set them up manually that is when we put our bash script in the user data to host our website on that ec2 instance but once we host our website and we we got to the point where the website is working then what we did is we create we created an ami which is this so pretty much an ami is once you set up your institute instance and it is working properly your website and it is working properly you create an ami of that website and you can use that ami to launch more ec2 instance that would have your web site configurations on it so that's what an ami does first time we set it up manually once we set everything up it is working properly we create an ami then now we are using that ami to launch new ec2 instance in our target group we are using the ami to launch new ec2 instance then we will put those ec2 instance in the target group and the application load balancer is able to route traffic to them so that's where we left off last class does anyone have any question about everything up to this point before we start what we are going to do today okay so just to show you this is my management console and that was this is my management console and this is the last two ec20 styles we created our jupiter ami 1a and 1b and like i said when we create the ami which is under ami we use those we use that ami to launch our ec2 instance which is our jupiter we called it jupiter server 1a and 1b then we put those institute instance in the target group you can see if i go to target group and select my target group i have the jupiter ami 1a and 1b and you can see the health check is healthy so once we put it in our target group now we can access our site using our application load balancer so under load balancers on that load balancing if you select load balancer we can now access our website using the dns name of our application load balancer so if i copy this dns name come here and i'll paste it in there press enter and there you go i can access my site excuse me so this is where we left off um our site is working properly we can access our site using the dns name of our application load balancer and one thing i said in the last class is that remember that um now our site is working but if i was to give you this number this dns name if i was to give you this dns name it has numbers and need and all that stuff right every time you have to come access my site you are not going to remember this you have to probably put the link somewhere and always use the link because nobody will try to remember this this is where um domain name is very important so what we are going to do now is we are going to register for a domain name and we are going to point that domain name to our application load balancer and the domain name will take place of this dns name so anytime we want to access our site we will be able to access it using the domain name we registered for so let me show you what that looks like okay so this is what our architecture look like we have our ami that we use to launch easy to instance if we need to and now the user we are going to register for a domain name in aws service called route 53 and that domain name is what we will use to access our website that is on the ec2 instance so we'll register for the domain name and this is the steps we are going to use we will register for a domain name and we will point the domain name to our application load balancer that's all we have to do and we'll be able to access our website okay so now let's register for our domain name to register for our domain name in the management console we are going to select services and i believe is under network networking and content delivery route 53 select route 53 or you can search for it up here so i'll just select route 53 now select it and the first time you are logging into ralph 53 it is going to look like this they always change it even mean i have to figure out okay you know it will look like this the first thing we have to do is um regist find it pick a domain name so one thing i want you to do now is pick a domain name this is domain name you are going to use for the rest of this class even when we create other all the other projects you always use this domain name and domain name cost 12 to register for so if anyone has ever tried to buy domain name online usually they start around 12 so we are going to register for a domain name for my site so my domain name will be different from your domain name if i any domain name i register for here you won't be able to use the same so you have to pick your own domain name so think of the domain name you want to use now um let me think of one so for this domain name i'll call it um let me pick a domain name i'll call it a o s class um i i don't know this is like the easiest thing to do but i always struggle with trying to pick a name so i think this is good enough for a dominion i want to pick something very simple so um because if i try to pick a common one it probably is not available so anyway i'll use this domain name aos class then i'll check to see if this domain name is available so once you click check it will let you know you can see the domain name i picked is available my aos class so my domain name will be myaosclass.com and you can see that it says status is available and it has added to the shopping cart for me here it is going to be 12 so at this point if you are satisfied with that domain name and it is also giving you some alternatives one here that you can use but i'm fine with my os class then come down keep in mind is it's going to cost you 12 a year to register for this domain name but um just keep that in mind then once you are satisfied with it come down click continue and in here is where you are going to put all your um personal information so in here i'm just going to because i'm going to be sharing this video online i'll stop sharing the screen i'll put all my personal information here then once you this place is pretty straightforward once you put all your information all you have to do is click continue so i'm just going to enter those information now so pretty much once you enter all your information and it's going to and you click next it is going to bring you to this page so the next thing we are going to do is um on that here this is where it actually do you want to automatically renew your domain name if you don't want to renew it every year because remember they are charging you 12 dollars by here per year so you press disable and once you press disable you are going to but if you want to keep renewing it you can enable it for now i'll disable it then you accept the terms and conditions and click complete order and here you go all that submitted successfully and it is also giving you some information here your dice being processed it might take a little little while for your payment to be debited um so just extra information so just click close and then it's going to bring you to this page on this page is saying i've registered for this domain name and it is going to take domain name registration might take up to three days to complete um they'll send you an email once it's successful and all that stuff but it doesn't usually take three days maybe at the most this is where we have to wait so at the most it will probably take maybe 10 minutes so um just to keep that in mind and all i'm going to do from here is click go to domains and there you go i'm on the domain on that in the don route 53 this is still the route 53 dashboard on that pending request you'll see your domain name there so if i go to the dashboard remember the dashboard is where we registered for it and once you register for it under pending request is where you will see that it is pending so this would take about 15 minutes or 10 anyway from 10 to 15 minutes then once this is available we are going to move on with the net with the lecture i'm not sure why the uh thing is showing up like this that's weird anyway in the meantime why we are waiting for this domain name to be registered does anyone have any question because we have about 10 minutes um for the domain name to be registered either if you guys have a question or if you if you want to take a 10 minutes break so it's up to you i mean we've done some stuff up to this point so it doesn't have to be what we are doing today if you have a question on anything that we've done up to this point this is a good time to ask the question hello yes yes the did you actually buy the domain or you just yes i bought it okay all right i wasn't sure um well i i used to have well i i still have the website but um for some reason the guy that was hosting it for me i didn't i didn't pay for the because i was gonna redesign it with somebody else so i didn't pay for the um a hosting fee but this wasn't on the um aws it was hosted by somebody else that i have to pay every every year hosting phase two but the question i have is if you if you have a domain that you already uh purchased you know outside of aws and other and i'm i'm quite familiar with all this particular lecture we're doing today because i i once had my domain which i mean hosting with godaddy and then and then i moved it to google so when i moved into google the guy that was hosting for me gave me the dns and that's how i have knowledge about you know i'm familiar so he gave me the dns um two dna server i think that's what it's called so and they then i went to google um back you know back end of the website so i i put the um like what you what you are describing now so i put the dns information that i gave me i put it there like in two places and that allows you know people that go to the website to be able to access you know my website and all that so again so the question is if if i already hosting i mean i already have a domain register with another provider let's say google go daddy there's so many of them now uh network solution and all that so can you still bring it inside here um and still be able to go with everything or you have to buy it uh through amazon aws or how does that work do you understand yes you can if you register your domain name with another domain name um provider you can there's a way to import that domain name in here and you'll still be able to use it to host your website but there will be additional steps of things you have to do so i've i tried to do it one time it which i tried to move my domain name from aws to um i can't remember i maybe it was from weeks yes from weeks i tried to move it to aws and it was going to take um about two weeks for everything to clear so it does take some time if you register the domain name with a third party and you try to move it into aws it takes some time for everything to click well yes you can do it you can do that so so basically so aws you know in aws you can pretty much do everything you know in what i'll say in-house meaning that within aw without having to go to google or register exactly okay so aws has all the most of the things you need to host your website unless if there is there are some things maybe they don't have for the most part it has majority of all the things you need everything that aws all their services there is always one thing you can use to host your website and for learning purposes and also to make things easier and we'll see reasons why using aws services is easier because they since it's their service they work well together with each other so i would recommend just buying the domain name through them as opposed to trying to bring one in that you own somewhere yeah so later on once we know what we are doing and we figure our way around then we can also look at that but usually that is a work most of because the company may have so many domain names they are using so it won't be convenient for them to um host register for those domain name elsewhere so everything they will probably be doing in route 53 so and yeah so but if you want to bring in your domain name you can do that it does take time but you can do it yeah okay all right thanks yes you're welcome does anyone have any question about what we've done so far so if i ask you guys now everyone can build a vpc from beginning to end like if we because our next project we are almost done with this project and the next project we are going to do you are going to create your vpc so at least if at this point i want to challenge you guys to know how to create a vpc as a next project that's what you will start will create start a new project and you'll start by creating your vpc this time we are going to create a vpc and the same type of architecture in two availability zones we'll be using two availability zones but this time we are going to be using six subnets so three in the first availability on zone three in the second availability zone we are going to have two private subnet in the first availability zone and two private subnet in the second one so for the next class i should all i have to do is give you the architecture and and you should be able to create that vpc by yourself i'm saying if you have a question um this is the best time to ask um quick question so the this aos class.com um domain name how do you know if it's associated with the port 80 or 443 um yeah it is not yet not yet okay oh yeah it is just a domain name we are creating for our site then once this domain name is available watch the question you just asked that's when we would do that so remember in our step the first thing is to register for the domain name which is what we are doing now the second step is then we'll point the domain name to our application load balancer when we point it to the domain when we point the domain name to the application load balancer that is where we would now set the listener on the list i remember application load balancer has a listener so what the post that the application load balancer is listening on would be when anyone access this when anyone access our website aos dot com aos class dot com then based on the rule we set in our application on the password it will either be traveling on let me explain it so once we point it to our application load balancer if remember what i showed you guys if i go and now type is aos.com i'll be accessing it on http obviously i can't do it now but if i type https.aos.com then i'll be accessing port 443 but that is what the user will be doing but you as the cloud engineer that you are developing your application load balancer in your own environment you have to make sure that you've set up the configuration for the different type of ports whether it's port 80 or port 443 that your end users are going to be using because you don't know which one they are going to use but the two parts are port 80 and port 443 so it will make sense once we do it i know i cannot so mainly all we have to do now is once this domain name is available we are going to point it to our application load balancer and i'll show you that part where you'll be able to tell all right sure yeah okay so this thing it takes anywhere from 10 to 15 minutes how do you know when it's done it will turn to blue yes once it is done it would it wouldn't show up on that pending request anymore and i'll be able to see it on my dashboard so if i go to my dashboard now uh it is still saying domain registration in progress this is because it is probably updating all the dns servers and all that stuff so it does take some time well one quick thing i like to also share i mean if if anyone in this class or someone you know if you are registering a domain name um maybe for your business or for other things from my experience it's always good to and if if it's something you are very serious about like you're running a business or something uh like like uh she said you know it's on the track 12 dollar used to be 9.99 but now it's across about 12 dollars so it's always a good idea to buy like in this case now hebor.com buy.net as well and buy.org or any popular um extension that you can buy the reason is that if eventually that business is successful people i let's say in this case now he bought.com somebody can buy.net uh because and there's a way to trick you know when you try to go to a domain name a vidtad.com he can route youtube.next that's true and uh that person will just be taking your business or eventually uh because i've seen you know like a couple of years ago i know people used to their main business is actually they just that is why now it's so difficult to buy domain names now you have to literally you know spell out something because almost any name you can think of now has been taken it doesn't necessarily mean that the actual functioning website for people who actually will go and buy them and then they will eventually my domain name now it's because i've had it for a long time you know if i if you try to get it now a good daddy will tell you that you want like five thousand dollars and so so in that so just from experience just try to when you register like.com if it's something you know that you're gonna keep it's not just for training or for future something buy.net buy.org and keep those three and keep paying for it every year you just never know if you have a successful business somebody who they know um they will take that net or the one that is available that you don't have so just something i like to share yeah that is true so that's actually a good advice i never thought about that yes so people can easily um reroute traffic going that is meant to go to your site to their site um yes so that's a good that's definitely a good advice um but like this domain name yes it does take some time so if you guys are following along so in your account now you should you can register for a domain name now whether you've done the other lectures or you haven't done it you can still register for your domain name now this is not connected to anything we've done so far it is just a domain name we are registering in our aws account so by the time you get through all the other lectures we've covered then you the domain name will be available for you to register to use as you can see it takes some time now i can't see it here anymore so good that means it is ready so if i go to my dashboard you can see i have one hosted zone dns management one usted zone and it is my aos class.com and the domain name registration is successful so this is how you register for a domain name it is that simple then once you register for your domain name the next thing we want to do now is point our application load balance points they do this domain name to our application load balancer meaning that when people access our site um they will be using this domain name instead of the dns name of our application load balancer so to do that we are going to come to service and we are going to select well not even a service so we are going to do it in this route 53 so to point it to our application load balancer you will select your hosted zone select your hosted zone and it is going to bring you in here and select the name of your domain name we'll select it and it is going to bring you here this is where all your dns record for this domain name you just register for is you can see the aos class.com so all i have to do in here is create another record and the record we are going to create is called a record so i'll just click create record all this so in here under record name in here let's just type www okay so it's www.aosclass.com we leave all this as default it the routing is going to be simple routing in rafted in round 53 they have multiple ways you can route traffic but we are just going to learn about simple routing we will be using simple routing but when you are studying and learning about picking up knowledge on your by yourself on aws just um learn what this other ones are but for now you is not something you need to oh sorry for now it is not something you need to worry about it's something you just need to know there are other ways to route traffic but um not something we'll be using here so i don't know why it keeps doing that so okay once you come in here it's ww in here it is going to be an a record then under alias right this is if you were hosting your website on an ec2 instance remember the first time we all started on an ec2 instance and we use the ip address to access it this is where you put the ip address so meaning that it will substitute your ip address for your domain name but since we don't we are not using an ec2 instance we are using an application load balancer we are going to click alias toggle it on then once you toggle it on select this drop down what is our alias meaning that what is you know ilias is worth like hiding something so what is the alias it is an application alias to application and classic load balancer select that then we are going to choose the region where our application load balancer is in remember our application load balancer is in the u.s east virginia region we'll select that then once you the next step is choose your load balancer so if you select here you will see the load bar inside we have you have currently running in that region you'll see and just select it and once you select it click create records and it has created that record you can see it here it is aosw.aosclass.com i'll select it and you can see better up here www.ilosclass.com now watch this is my website that i was accessing previously with my application load balancers dns name if i refresh i mean it's probably still showing that but eventually it is going to time out or maybe it would still even still be available but just say for now i'll just leave that but it is still showing that you can still access it with that oh yes that is true okay it makes sense you'll still be able to access it this way right because um the application load balancer is what is routing traffic to our ec2 instance so it does make sense you'll be able to access it but the thing is like nobody will know what this name is so you don't even need to worry about it but think about it you are accessing other people's site amazon.com whatever the application load balancer is you don't know what the dns name is because this is something that is not even exposed to the public so that is why this is still working it makes sense it should work but once we set up our essay https listener this will probably not work anymore because right now this is only working on port 80. you can see it is saying not secure that is port 80. okay so not to confuse you once you just ref once you create your a record now i'm going to close that just to show you that i'm going to copy my domain name here and come here and paste it there and press enter and there you go you see i'm accessing my site aos class.com it is saying no secure because i am accessing it on port 80 and how you can tell you're accessing your pod it is if you copy it in a notepad let me paste it down there so i copied the address i'll paste it there you can see it is http does anyone have any question and can you see my screen or is it too small yeah i can make it a little bit bigger okay so this is how you point your domain name to your application load balancer so now this is what you give the users coming to your site now this brings us to the question we've now we've set up our site the domain name we set up the domain and everything is working what if i type um try to access my domain name on https right let me paste this here and i'll just add s here and i'm going to close this and try to access see it it was it's going to give you an error that it can be rich because remember when we create our application load balancer the listener we set up only listings on port 80 meaning that it is only checking traffic that is coming up for 80. now that i'm trying to access it on https it is giving me an error so this is where the next step comes in where we are going to register for an ssl certificate in order for you to be able to set up your port 443 the first thing the main thing that is needed is a ssl certificate and this certificate is free it is very easy to set up we are going to register for that certificate then once that certificate is available we would now go in our application load balancer create a new listener on port 443 and we'll put that certificate on that listener and that is how we'll be able to route traffic on port 4432 so just to show you what that means and i'm going to um under services here we can type certificate manager so so once you start typing certificate manager select it it's going to bring you to this page and here we are going to click this one which is says um where you want to register for an ssl certificate so we'll click get started and it is going to be request a public certificate we'll click request a certificate in here is where you are going to put your domain name so my domain name is aos class right dot com all right i believe that's my domain name let me yeah that is it i always always try to be careful but it's ios class.com then this is my domain name that i want to request the ssl certificate for then another thing i always like to do is i can also request because remember i set up my domain name as www.example.com so the first wwe that is this they call that sub domain name meaning that every time you go to like a website you can see that like you can say projects.amazon.com on web.something www.something when you see a word before the first dot that is a sub domain name so now that means you are what we are trying to do here is request another one certificate that we work for when our users is coming on aos com and whether and when they are coming from um www.aosclass.com so to request for a sub domain you will use the star period and your domain name so i'll just copy my domain name and paste it there so that is how you request a subdomain name of your domain name and remember a subdomain name is when there is something before the main domain name this is the top level domain name right your the one i register for aos class and anything before it ww dot app dot or whatever is the sub domain name so once you um once you enter this information click next and on this page this is where you have to verify that the domain name belongs to you just because you come in here and type your domain name don't mean that amazon will just give you the certificate you have to verify that the domain name belongs to you there are two ways you can verify the first one is true dns validation a second one is email validation so if you choose email they will send you an email and you have to go in verify to then once you verify the email the ssl certificate will be available for you to use but since one of the benefit of using route 53 and or using amazon services is because since we register our domain name in route 53 this dns validation means that when you click next it will give you some some cname it will give you like a a text like a text texting with like a name in it or something and it will tell you to put that name under your dns record so let me show you what that means so if i go to route 53 this is my hosted zone this is my aos class dot com you see these are the dns these are pretty much all the records under this aos class dot com so to verify that that domain name belongs to you if you choose dns record dns validation they will give you something like this to paste to put in here and that's how they will verify that it belongs to you in cases where you are moving your domain name from other parties to that's what you have to do you have to come and enter the record in here so the good party by registering in round 53 is ralph 53 would automatically do all that stuff for you so i'll select dns validation and click next if you want to give it a tag you can enter a tag but i'm not going to give it a tag i'll click review so it is reviewing it my domain name is aos class.com let me just verify yep then and under the validation method i'm choosing is dns i'm just going to click confirm and request so the same validation pending validation and if i click this drop down this is the name that i told you that they are going to give you to put in your ralph 53 record so you have to come in there and put this c name in your ralph 53 record under the all state zone for your domain name so the good thing about this is since we registered this in route 53 right our domain name is registered in route 53 all i have to do is create record in route 53. you see this create recording rafter in route 53 once i click it route 53 amazon would automatically put this name in my rav53 um hosted zone so you'll see so i'm just going to click create record in route 53 see it is showing me that it is going to create this record in my route 53 outside zone i'll click create it says success and we are going to do the same thing for the sub domain name we are requesting create record in route 53 and the showing you it is going to add the c name create remember what the c name looks like so i think they are the same yes they look the same so now if i come to my round 53 record i'm going to refresh you can see that scene in there it's this one so then it is successful in case in cases where um let's say you were trying to put it manually this is also the file you can download the file it has the cname there and you can use it so if i download it i'll open it just to show you you can see it is the same c name but since you are registering it from route 53 you don't need to download this um because what this is telling you to do is just giving you the information you need to update on your hosted zone but rat53 has helped us put that record in our hosted zone automatically so you don't need to download this then click continue you can see it is success once you see successful ios um your domain name and the sub domain name this is the ssl certificate you are seeing here this is the detail of the ssl certificate now we can use this ssl certificate to secure our website and that is as simple as that so raise time for an ssl certificate this is how you register for it very simple then now let's go and um let's go and use this certificate to secure our website let me show you the okay okay so this is what we did we created a domain name here right we wrote it we added a route to it to the application load balancer now when we come to our website we are using our domain name to come to our website now we just register for an ssl certificate the next thing we need to do is create a listener on port 443 then we are going to put that certificate we register for in that listener and that is how we are going to be able to access our site on port 443 let me show you the steps so we registered for an ssl certificate we did that the next step is we are going to create an https listener on our application load balancer then we are going to add our ssl certificate to it so let's go back to in your aws management console let's go to the ec2 service so i can go to home type ec2 up here and we are going to select not running instant so in your ec2 dashboard right come down and we are going to select underload balance and select load balancers on your load balancer page we are going to select listeners remember when we were creating our listener with we created this listener on port 80 that was the stuff where it showed you and i told you we're only going to leave it on 80 for now when we later on we set up our https so that was this list now we created in the application load balancer lecture we are going to add another listener this time it is going to be https port 443 default action it is going to be forward to and we are going to forward it to our target group and we will come down so default action we are going we are saying forward right any traffic coming on port 443 forward it to our target group remember my jupiter target my jupiter tg that is the target group that my application load balancer is currently routing traffic to any ec2 instance in that target group is where my application load balances routing traffic to so remember https you select default action forward to target group then you come down under security policy this always stays the same don't change that then on that default ssl certificate right you are going to click this drop down and you can see i only have one certificate in there right now the one i just registered for i'll select it and click add listener so now you see successfully created listener on port 443 and there you go that's all we need to do so now if i go back you can see i have i have um two listeners now one is listening on port 80 forwarding my traffic to the target group another one is listening on port 443 and forwarding the traffic to my target group now if i access my site not this one now if i use https right https to access my site paste it there you can see it is https press enter there you go you see i have the lock icon connection is secure and this is how you get to all the sites you guys go to this is it at this point our site is done you're ready to people to start accessing it using our domain name and all that good stuff now watch what happens again if i now try to access this site again on http port 80 aos class paste that there press enter i can still access it this was what i was showing you guys about this website my zoom thing is always in the way this was what i was showing you guys about this website so when i access it here i can still access it it is saying not secure if you look at mine not secure and when i try to my something is always in the ways annoying excuse me i know you guys probably can see um so now when i try to access this site again let me copy their domain name here so that is the other site so this is the http so i'll copy the https copy now put https here so now when i try to access this site on https let me close this and show you i can access it because you know why the same thing we just did they set up two listener one on port 80 one of port 443 that is forwarding traffic to their target groups however they did it right so in the case of what we are learning because we have two listeners one of port 80 and port 443 forwarding traffic to our target group if the users are coming in coming into our site they are typing each um aos class.com they will still be able to access our site but it will only be defaulting to port 80. so let me try that now i'll type aos class dot com press enter see anytime you type that it is always going to default to port 80. in order for you to go on the https you have to specifically put the https next to it so that was what was happening in the case of diode site you see now my site is accessible through port 80 and port 443 so now to stop this from happening we have to go back to our ec2 console under the application load balancer you see this our http listener we have to edit the rule for this listener the actions of this listener we have to edit it so we are going to select it select edit right look at what the rule is saying we are saying anytime a user is trying to access our site on port 80 forward them to our application load balancers target group we don't want that so what we are going to do is we are going to delete this once you delete that we are going to add a new action right so now we are saying whenever the users are trying to access our site on port 80 we want to redirect them to and what do you want to redirect them to https so in here we just type 443 and that's all we need to do you understand so we are saying anytime a user is coming on port 80 redirect then we direct that traffic to https and once you put that everything else here stays the same will click update it has successfully modified listener on port 80 so we'll go back so you guys understand now port 443 is routing traffic to our target group so anytime someone is trying to access on port 80 it is just going to redirect it to 443 which will go to the target group so it's like this 80 is not doing anything but helping us redirect our traffic to 443 so let's go and test it now so i'm still on this port 80 let me refresh you see what will happen you see right instantly it changed to um secure 443 see https let me show you guys again if i come in here i'll type aos class dot com see it is instantly redirecting it what if i type http so remember i have the http you have to test everything so what if i type httpaosclass.com close that remember this is http you can see there press enter see it is automatically redirecting it and when i was telling you guys on that other site that is just one simple step that they forgot to do does that make sense and does anyone have any questions okay question on um the suggestion i was given earlier around about buying multiple uh extension for a website um oftentimes like you know you know sometimes i mean of course you have dot net and dot com and dot org and all that um sometimes for example now i have a you know my navy federer um um banking um website if i try to go to their website their domain name is dotnet but i'm i'm so used to do using ctrl enter to put to automatically put www.com so when i do so of course the the right domain name they have is dot net but when i do control enter and they put dot com it will still take me to their website so so one one so if you mister even if you don't remember the website because we are so we are so defaults to dot com.com.com for majority of website as you know at dotnet or does something else so if you have um a domain name like register now and if you have it as dotnet or dot org and all that but you want to make it easier for people when they try to access your website whatever you think of the popular domain extension they will type for your website to automatically route them even though it's a mistake in fact some people even also do it to the point of as you have you you think of possible errors people will make when they are typing websites for like we have aos class now so some people will even register aws class thinking that people will make those mistakes so when you have multiple sites like that i mean multiple domain names are to register like that so do you have to set them up like all the things you did about you know routing individually to make sure that people regardless of what the type is still going to take them to the main goal yeah so for those ones for all those other domain names that you think people would type in you would have to go and register a domain name for it then the way we point that alias to the application load balancer you will be pointing everything to the application load balancer so if those people are you register an ssl certificate set everything up like that so so that way if those users are typing those domain name it will keep routing them to um they but there's probably like a way to redirect it um but that is yes because for for my website i have dotnet and dot com and usually when i give the site to people i just say dots.com but i know that sometimes people by default or mistake so um but of course i'm learning this with you now but in the actual server the person that was hosting it for me i went in there and it's it's it's kind of very looking familiar with me now with what i used to do so i automatically forwarded the uh dot com to so even if you type dotnet or whatever it's gonna take you to yeah so main thing so one thing i'm realizing that's just like if you as a company wants to do that you know um i guess the main understanding is if your users are trying to access your site they should know the name anyway but obviously true it is also you can try to fix that human error where you can those are additional things you have to do which you really don't need to do that you have you can do to make sure that if they are typing something it comes to your the traffic comes to your website so for example amazon don't have that setup so right now if i type amazon.net right it just tells me it's not it's available okay okay you think amazon as big as they are yeah because they expect people to know that they are supposed to type.com.net so if i go back now and just do amazon you see it works so it's just an additional thing you can do you really i mean it's based on you if you cuz people can type so many different name and to try to remember all the things they can type wrong um is an additional step that you really don't have to configure you know the main thing you want to worry about is making sure that if they are typing your domain name whether on http or just typing it like this it is redirecting them on a secure traffic port 443 that's all does anyone have any question is this stuff exciting to me it is so when you guys access people's site and you see this lock icon there and all that stuff this is one of the if it is hosted on aws this is how they did it okay so we are done with pretty much our we're almost done with this project right now we have set up everything this is a vpc we have two ec2 instances in the private subnet we have um night gateway that is helping them route traffic to the internet we have set up an ami so if we need to create new ec2 instance for our website this ami will allow us to do that we've set up our route 53 set up our ssl certificate to secure traffic on port 443 so we are really done the one last thing we need to do now is we need to add elasticity remember when we talked about that and scalability to our application meaning that right now these two ec2 instances we manually created them here and this is where we talked about when let's say this is these two ec2 instances can only uh accept traffic of 1000 people in the case where it was black friday the traffic increased to 2000. we want this institution instance to be able to add new servers without us even coming in and manually adding any server we wanted to be able to just create new server by itself while we are sleeping or in another case where this ec2 instance just fail something sometimes things happen where the easy to understand something will be wrong with the aws underlining infrastructure and the ec2 instance will fail right we want another new we want to be able to automatically remove the bad instance and create new ones in there without us having to come in manually and do that so this is where we are going to introduce autos auto scaling group auto scaling group is this aws service that will allow you to be able to scale up your ec2 instance by scale up by adding moisture to instance or scale down by removing ec2 instance so that is the last part of our project that we have to cover and we are done with this project so let me show you okay so we have everything now we are going to create an auto scaling group and if you see you see this little orange line the ec2 instance are in the orange line meaning that the auto scaling group is the one creating the ec2 instance if you look at the one we had before we manually created them now the auto scaling group is the one responsible for creating those cc for instance and this would free us from having to go in and manually do that so that's what we are going to do next so let me close this our site is working good to create our auto scaling group let me start at the home so we are going to come to ec2 so if you type ec2 in there select the ec2 service and to create our auto scaling group let me show you the steps the first step is to create a launch template a launch template means that it is a template think of what a template is a template is just something uh how do we how do you put it let's say you are printing a shirt right there's a template you use to print the same type of logo on that shirt like a prototype exactly so um that's just a template it's the same concept here we are saying the launch template will be what our ec2 should look like every time our auto scaling group is creating them so we will create our launch template with delhi we want to use this ami we want to use this ec2 instance type pretty much everything we select in that configuration when we are creating our ec2 instance would create that launch template so when our auto scaling group is creating new ec2 instance it will create them according to our specification in the launch template so that's all a launch template is so in your ec2 console we are going to select launch templates here and we are going to select create launch template we'll give it a name i'll call it jupyter launch template right and i'm going to use the same name as the description right so the next thing is auto scaling group guidance because yes our auto scaling group is going to be using this launch template so we are going to select provide guidance to help me set a template that i can use for ec2 auto scaling groups so what this means that when you are creating this launch template it will guide you and help you remove all the extra settings you don't need because because all not all the settings will work for auto scaling group so by selecting this auto scaling guidance it will just help you remove some of the ones you don't need and you'll see that as we go so check that box come down on that amazon machine image right that is our ami remember when you are creating your ec2 you specify your ami we are going to do the same thing here but remember we created our own ami so if you keep scrolling down i'll scroll down under my amis you see the jupiter ami we created in the last class i'm going to select it so i'm telling you now when my autoscaling group is using this launch template to create an ec2 i want to use my jupiter ami the next option is your instance type again we always use t2 micro so you come here and you select t2 micro make sure it is the free tier there are some instance type here that cost a lot of money like a lot so please be careful and make sure you select t2 micro free tier so when you are clicking it please be even be clicking it from this free tier so you know you are selecting the right one and when you look in here it should be t2 micro three tier we are going to scroll down under key pair that is where we are going to put the key pair that we always use to ssh into our ec2 instance so i'll select this drop down you should see one key pair in your node and virginia region that we've been using i'll select that keeper scroll down network settings yes it is always going to go our ict will go in a vpc and under security groups we are going to select a drop down and we want to put it in our the security group we want to associate with it is the web server security group that is the one we created for this project so this is where naming your security group by being descriptive is very important because i can see my web server security group here i'll select it then storage will leave storage as default tags we are not going to add any tag network interface nothing then under the advanced details select the drop down and in here um you can see um um all this we are going to leave as default we don't need to change anything here the only thing we can um the only thing we can change is detail cloud watch monitoring if you want to enable it you know remember we say cloudwatch is the service you use to monitor the metrics of your ec2 instance and cloudwatch reports um service every five minutes it reports your metric every five minutes but i think if you want to be much um detailed about it you can tell it to report it every one minute so that's what we mean by detail cloudbot monitoring i always enable this but everything else here we are going to leave as default so leave everything else as defaults come all the way down and click create launch template we have successfully created our launch template and that's all you need to do you can view your launch template and you'll see it here and that concludes on the first step let me close some of these other ones okay the next step is we are going to create our auto scaling group so to create our auto scaling group in your ec2 console we are going to come down we are going to select auto scaling groups we are going to click create auto scaling group we'll give it a name i'll call it jupyter auto scaling group i'll just call it asg so jupiter auto scaling group see now it is asking me to choose my launch template sometimes right your thing may be on there are two ways you can there are two things auto scaling groups can use to create your ec2 instance before we used to use launch configuration but aws has changed it where the launch configuration is still available but the one they recommend the most is launch template so that's why i'm teaching you guys a launch template just in case if you select this drop down you don't see a launch template here for example yours might be on launch configuration you may see launch configuration here and if you select here you won't see anything to select that's because you are on launch configuration so just select switch to launch template and make sure this is saying launch template and when you select this drop down you see your launch template we just created i'll select it and it's going to give you the preview of the settings on that launch template i'm going to click next and in here is where we are going to be configuring the stuff for our application load balancer under the instance purchase option we are going to leave that as idea to launch template then we'll come down on that vpc which vpc do we want our auto scaling group to create the easy to instance in well we always create we are going to create in our jupyter vpc right then we will select our subnets remember in our application right um [Music] our ec2 instance we always we are going to be creating them in private subnet one and private subnet two so on that subnet i'm going to select my private subnet one i'm going to select my private subnet too once you select those two click out make sure you have private subnet one and private subnet 2 then click next under load balancing yes remember we have a load balancer let me close this other ones underload balancing remember we have the only way people can access our website which is on the ec2 instance in the private subnet is through the load balancer so we have a load balancer that is routing traffic to the target groups that we put those ec2 instance in so that's what this option is saying we have a load balancer so we will select attach to an existing load balancer right and here it is saying the next option is saying choose from your load balancers target group right yes that is this is the option we want we'll select the drop down and you should see your load balancer target group you see my jupiter target group i'll select it and i'll come down under the health check remember i also told you that your application load balancer is also smart enough to detect whether your ec2 instance are healthy and if they are not healthy it is not going to route traffic to them so this part is optional but we can also enable the health check on the load balancers too then under additional settings um enable group metrics collection within cloud watch this is also optional but we are going to enable it if you don't enable any of this it is not going to break anything but we should just enable it um to give us just a better configuration we are going to click next this is where the configuration of the auto scaling groups comes in remember we said when our auto scaling group wants to start creating more servers or removing some servers we don't we will be sleeping so we don't even know when it is going to kick off that workflow this is where one of the place where we set up that configuration so on that desired capacity this is where we will tell it at all times at all times how many ec2 instances do we want to maintain running currently our architecture we are just using two let's say we have four ec2 instances here that we want to keep running at all times then that is going to be our desired capacity but for right now our desired capacity is two meaning that on a normal business working day we always want to have two ec2 instances running so in here we are going to change this to two the minimum capacity this means that when our auto scaling group wants to scale down because the two easy to instance we have here is not really serving the enough people are not coming to our site so it's just sitting there not doing anything right we want to remove so what the minimum capacity is saying that when your auto scaling group is scaling down meaning that when it is removing servers how many servers do we wanted to limit it to so we'll leave this at one and under maximum capacity that is the opposite of minimum when our auto scaling group is adding more servers how many servers do we wanted to keep adding it will keep adding servers until you get to how many servers will save for so let me explain what this means again desired capacity 2 meaning that at all times we will on a normal working business we always have to when our auto scaling group detects something and it wants to remove server it will keep removing our server until it gets to one and it will only leave one and if our auto scaling group detects something and it wants to keep adding servers it will continue to add servers until it gets to 4. when it gets to 4 it is going to stop if we put 10 in here it will keep adding servers until it gets to 10 but it won't it would only add more servers based on if it detects that it needs more server let's say your norma 2 is easy to use to serve for like sub your normal ic2 instance serves 1000 users and now two thousand users start coming to your site your auto scaling group will scale up and add more servers but let's say we put ten yeah it won't it won't just keep adding until it gets to ten no it will add one server and it will see if now you have three it will see if those three can undo those traffic if those three can enter those traffic it is going to stop but if it can't it will add one more to maintain it and it will check whether the four can handle so we'll keep doing that until it gets to your maximum so remember desired capacity to minimum when it is scaling down one and maximum when it is scaling up for but this number is whatever you want it to be you can put 10 here um two here it doesn't matter but usually for companies they will have bigger numbers here then um scaling policy is also an additional thing we can use we'll do that next but scaling policy allows us to also add more servers and remove more servers based on some type of metric and the metric we are going to use is the cpu utilization so we are saying like if we have an ec2 instance that the cpu utilization is less than 30 meaning that when your cpu utilization is low it means that you it is not being used so we'll tell you if we have an ec2 instance that the cpu is low we want to remove it so that is what this would do but we'll set this up next for now we'll leave it as none so that's all we need to do on this page and we are going to click next on that notification this is when your auto scaling group detects something and it wants to take some action it would send you an email saying oh i want to add one server i'm terminating one server this is just for your activity yes we want to add a notification i'll click add notification and remember we already set up an sms topic when we set up our cloud watch alarm right for our billing in the first lecture so we can use that same topic because we connected that topic to our email in case if you didn't you don't have that topic you can click create a topic here you will you click create a topic you give that topic a name and you add your email address to it but what if you do that make sure you go to the email and verify that topic you have to verify mean that they'll send you an email you just have to go to your email and confirm it but since we already have a topic in here let's use our billing one we set up then these are the events that the auto scaling group will notify you on it will notify you on launch you will notify you on terminate it will notify you if there is a fail to launch and if there's a fail to terminate we'll leave all this on click next we are going to enter a tag right this is similar to um the way we've been tagging our ec2 instance so i'll call it um it auto scaling group ec2 so this i'm tagging these two instances mean that when the auto scaling group is creating the ec2 instances it is going to um add this tag to them so you can see here tag new ec2 instances it is going to tag them this a auto scaling group ec2 then i'll click next on this page we're just going to review everything scroll all the way down and click create auto scaling group remember on our auto scaling group we said our desired capacity is 2 minimum is 1 and maximum is 4. now watch what happens if i go to my ec2 console so i'll go to ec2 now select running instances i'll refresh let me come back here it's still updating capacity right okay so i come to my ec2 instance i refresh let's give it some time you will see that the auto scaling group will start to create one new will start to create my ec2 instance in here so let me select instances first you see it is still under pending that is why it's not shown the auto scaling group you see asg ec2 the auto scaling group i told it at on the normal working thing i want to always maintain two ec2 instance so it is time to create those two acetone instance so let me go back to the dashboard again and select run it and you can see them there the asg ec2 you can see they are just initializing these other ones we have here remember this is the jupiter ami one we created manually remember we first created the ec2 manually now we are using auto scaling group to create them so now that we are using our auto scaling group to create our ic2 we are just going to terminate the ones we created manually so the ones you created with the jupiter one manually right we are going to terminate them i'll just select those two and i'll click terminate instance because we really don't need them because we always want our auto scaling group now to take the place of creating our ic2 for us now we don't have to come back in here select launch instance and all that stuff so i've terminated those instance that i created manually now you can see the ones in here are the ones that my auto scaling group is creating for me and you can tell by the name because i told it any c2 instance you create target the name asg ec2 all we have to do is wait for this to pass the status check if i try to go access my site now well it is just still it's probably picking it up already but um let me try that again yeah it's probably still picking it up right you can see my site is working so maybe when this is initializing right it is still my sight is still working let me try it in incognito i say it could be the catch yep it is working so he's still picking it up and you can see now that you see that i terminated the ec2 instance that i created manually right and i can still access my website that is because my auto scaling group is creating this new ec2 instance for me even though it's saying initializing it has already um passed so even you see that one has passed that's why i can access my site and the other ones the other one will probably pass on right but when it's showing initializing it means that it has probably finished the part where the configuration to access my site is there now if you go to your target groups right i'll go to target groups that too easy to instance um multi-skilling group just created it is automatically putting them in the target group you can see if i select target group you can see my target group has two ec2 instance in need and you can see that those easy twin stands are my auto scaling group ec2 and they are healthy remember when we were setting up our auto scale and go with today yeah we want to we are using an application load balancer i want you to put it in this target group when you are creating it that's exactly what it is doing so and again i can access my site so now we just introduce what we call scalability into our application meaning that our application can skill without us touching it and let me prove that to you i told my auto scaling group so if i come down on that auto scaling group is right here i told my auto scaling group that at all times i want to maintain two ec2 instances watch what happens so i'll go back to the ec2 console so i'm under ec2 now it's just two different tabs that i open sometimes if you are working on something right this i'm under the auto scaling group if you want to open a new tab all you have to do is right click here open a new tab and in this tab i can go to ec2 right remember i told my auto scaling group here i told my auto scaling group here that i always want two ec2 instance running at all times my desired capacity under my running instance you see that i have two ec2 instance running watch when i take one of this i'm going to terminate it all right i'll refresh see i've terminated that ec2 instance you can see successfully terminated i'll give it a couple of minutes like i'll give it some time what was going to happen auto scaling group is going to detect that i don't have too easy to instance because i told it i want to easy to instance run it would detect that i only have one ec2 instance running and it would automatically start to create another one so let me refresh i'll give it some time because the auto scaling group it has some time built into it where and you can always adjust those time it has some time where after some time not very long that it would detect but um if you want to see because right now i'm only filtered by running instance if i want to see all the instances that i have going on you can see these are the ones i have terminated but if i keep refreshing here you see after some time you will see one ec2 instance will come back i'll just give you some time maybe like a minute or two you have to give it some time for your auto skilling group to catch it refresh in the meantime while i'm waiting for this for the auto scaling group to detect it does anyone have any question okay um the question i have is um when you put you know when you set up the uh auto scaling you put one or two at all times one for minimum and and four for maximum does that one two four denote some kind of ratio like maybe one is um every one means one thousand or you can actually put one thousand or one million or whatever whatever you know the traffic to your website will be yes that one means one okay one means one ec2 instance so if you if i want to put 1000 um easy to instance scale down yes i will have to type 1000 in there okay yeah so it takes time give it a give it some time it will pick it up you'll see there you go you see you see it has time to is it i started creating a new ec2 instance which is pending see the other three are the ones that were terminated let me wait for this to the states to change to running then i will filter it so you can see let me just go to our filter and go to my dashboard filtery because this data has not changed to pending that's why you are not i mean this because the state is still on pending it has not changed to running that's why you are not seeing it in here but see it is now initializing and you saw that it did that automatically i didn't have to go in there and create the isotone stands manually because it is going by my desired capacity which i said is too and um if i try to access my website my website remains working all the when you guys are accessing people's website on the all the time things like this are happening on the back end but it does not affect your experience as a user because they've created the application to be what we are adding here is fault tolerant application application that is scalable and elastic it is fault tolerant because when i terminated one ec2 instance you could still access my site from the other ic to instance if my site was still working you as the user you wouldn't even know that uh there was a 41 ec2 instance on the back end and when my auto scaling group detect that it created another ic20 stance for me that is scale scaling meaning that i told it i always want to ec2 instance it is maintaining the ec2 instance for me at all times the last part of this project we have to do is the scaling policy this auto scaling group there are so many things we can add to it to make it more robust the only ones we will talk about is just the scaling part the scaling policy well it is the scaling policy but remember what i said we are going to scale up based on the cpu utilization meaning that if we just have this too easy to instance sitting here now i have this too easy to instance here they are hosting my site but nobody is going to my site right now so that means that they are just sitting there maltose getting group will be smart enough to realize that and it will remove the instances based on my settings here so when you realize that these two ec2 instances are here and their cpu utilization is lower than what i would put in the scaling policy it will start to remove one right it will be removing them one by one until it gets to my minimum so right now i only have two so all it will do is remove one which will get it to one minimum so that is what the scaling policy is but we can also do a scaling policy to scale up meaning that if we put a certain amount of scaling policy and the cpu utilization is greater than a setting threshold it will add so let me just show you what that means um again on your ec2 console we are going to come down you are going to select auto scaling groups you select your auto scaling group you created under automatic scaling we are going to select it then in here is where we are going to create our on our automatic scaling so you see where it says create dynamic scaling policy we're going to click create that so on that policy type select this drop down we'll just use simple scaling that is what we will use for the entire of this project and the other class so the scaling policy name we are going to create two scaling policy the first one we are going to create is for remember what i said when our cpu utilization is greater than its setting threshold it would start to add more ec2 instance for us so for this one let's call it high cpu so i'll call this icpu right but when you are creating a scaling policy remember cloud watch right cloud watch as an alarm just like the alarm we created for our billing way we can always tell that alarm if something reached a certain threshold kick off the alarm and when it kicks off that alarm that is when the auto scaling group will start to take that action so in here we don't have any alarm other than our billing alarm so we need to set an alarm for this scaling policy we want to create so let's click create a cloud watch alarm it is going to open a new tab for you you are doing stuff here when you click this it will open a new tab for you here in here you select metric the metric we want is um [Music] ec2 and select auto scaling group by auto scaling group it will bring you here the metric we want to use is the cpu utilization so you can see there's different metrics here that you can use to trigger an alarm to take some type of scaling action against your ec2 the one we are going to use is cpu utilization so i'll check it click next so i click select metric excuse me so in here under the namespace leave everything as default make sure the cpu utilization you don't change it and make sure you see this graph here if you don't see this graph it means your something is wrong with your settings so make sure you see the graph then the statistic is going to be average for the period meaning that how long will he check it let's reduce it to one minute or 30 seconds so well 10 seconds is to let me do one minute so let's do it to one minute so that way it will be able to detect it faster the threshold type we are going to leave it as static and whenever cpu utilization is this is where we will tell it right i'll use greater than or equal to because the first one i'm setting is greater than or equal to and in here i'm going to put 80 right so let me explain what this means so i'm saying that whenever the cpu utilization on my ec2 instance is greater than or equal to 80 for one minute it is going to trigger this alarm so that's what that means again whenever the cpu utilization is greater than or equal to eighty percent for one minute this is going to trigger the alarm when your cpu utilization is greater that means that more people are coming to your site and they are using your ec2 instance so there is more load on it and it is using more cpus at the point where you are approaching almost hundred percent you want to tell the auto scaling group to scale up and add more ac to instance because when it has more it is more ec2 instance your application load balancer would evenly route traffic to the extra new ones so that is what this is saying here we are going to click next and in here we are going to come back up on that notification it is going to be in alarm and we are going to choose under select an sns topic we are going to choose an existing sns topic which is our billing sns one we can use the same one we don't have to set up multiple sms and you can see the email it is going to notify me on then that's all we need to do here we are going to come down click next and we are going to give this alarm a name remember what we are creating here is a cloud watch alarm so we are going to give this alarm name we are using this alarm for icpu so i can call it i cpu i guess i can space it icp you let me put a dash i cpu alarm i spelled that right so i'm going to copy this i'll use the same name as the description and i'll click next so i'm creating that icpu alarm i'll scroll down click create alarm you can see my height you can see this is my billing alarm the one that alerts you when your estimated charges is above ten dollars the one i just created is a icp ui lamp the one that will notify me if the cpu utilization of my ec2 instance is greater within one greater than greater than or equal to 80 for one minute so that's the new alarm once you create your alarm don't forget to finish creating your scaling policy so i've created my alarm i'll come back here to where i was creating my skilling policy refresh and when you see click in here you will see that high cpu alarm we just created we'll select that we connected that alarm to this scaling policy so now this is where the auto scaling group will take action so take action meaning that when this alarm is triggered remember this alarm is saying whenever your cpu utilization is greater than 80 it is going to trigger the alarm the icpuala and when the icpu alarm is triggered what do we want to do well we want to add server so we'll put server here and and how many do we want to add server we can increase this to one so let me say capacity unit so what this means is that when this alarm is triggered this icpu alarm is triggered add one new server and the auto scaling group will add one new server and now we will go from two to three and it will monitor it make sure our load our traffic the cpu because when you add three servers now that is having your people coming to your site the cpu will drop but if the alarm triggers again it will keep adding one but it will keep adding one until it gets to the four because we specify keep adding one until you get to four so that's what this means click create but don't if you don't understand this we are still going to do it like five more times so by time you are done with this whole class you will so we have created our high cpu alarm this is to add servers now we need to create another one for our low cpu meaning that if our cpu is low we want to remove servers so again we'll just click create dynamic scaling policy it is the same way we created the other one i'm going to select this simple scaling we'll give it a name let's call it low cpu then under cloud watch alarm remember we need to create an alarm for it so i'll click create a cloud watch alarm select metric it is going to be ec2 by auto scaling group remember the metric we want is cpu utilization i'll select it just in case if you can find the cpu utilization there just start to type it in here the same way you see it on my screen if you start to type cpu it will pop up so we want the cpu utilization click next to select metric you'll see it in here we'll leave all this as the same and for the period let's select one minute as well we'll go down threshold is going to be static now we are saying whenever the cpu utilization this time we want to say lower i say whenever the cpu utilization of our ic20 stance is lower than let's put a metric in here and i'll put a number that it would allow it to trigger very fast so let me put 35 so i'm saying whenever the cpu utilization on my ec2 instance is lower than 35 meaning that when you are not using it the cpu will be very low whenever the cpu is lower than 35 for one minute i want you to trigger this alarm i'll click next remember i will go back up we want to add it to an sns topic so it will be in alarm we are going to choose an existing sns topic click this drop down or add it to the building topic we created and you can see the email it is going to let me on i'll come all the way down and click next and remember what we are creating here is the alarm so i'll call this lu cpu alarm i'm just going to use the same name as the description click next and we are is giving us a preview right scroll down and click create alarm we have created our low cpu alarm you can see it is still saying insufficient data it is saying insufficient data because we have to connect it to our scaling policy you see our high cpu alarm is okay because right now nobody is accessing my site so the cpu is not changing so this would take more people to access my site for me to raise the cpu to eighty percent so that's why the alarm is saying okay but remember nobody is accessing my site now by the time i create this low cpu alarm it should trigger this alarm because now nobody's accessing my site so it should trigger it so once you create the alarm come back here click refresh and select create a not not create alarm click refresh and we are going to select this drop down and we'll see our low cpu alarm in the selected and we are taking action so we are saying when this low cpu alarm is triggered what do we want to do well we want to remove remember when the cpu utilization is lower meaning that nobody is accessing your site you don't want to add more you want to remove so we are removing how many servers do we want to remove at a time one at a time that's all this means we'll click create and that is how we create our scaling policy we have a icpu and we have a low cpu and now if i come here to this alarm eventually it is because i just connected eventually watch it would um change i'll click i'll click on refresh it's still collecting the information that's why it is saying insufficient you have to because we just created it so once it gets all the information on the easy to instance uh we specify for one minute so eventually it will change you'll see that this low cpu alarm will change to our alarm state because if we go on ec2 right now and we go on monitoring right look at the cpu utilization of ma'alam it is less than 2.5 it is 2.5 which 2.5 is less than 30 so we are saying anything less than 30 meaning that we are not using the ic2 instance and we want to remove the ones we are not using you can see the percent of my ec2 instance right now because i'm not using it nobody is accessing it this is the cloud watch thing that i was showing you so cloudwatch is what you use to see all the metrics of your ec2 instance see my cpu utilization is 2.5 so let me go back to the alarm and you can see that i have one alarm i'll refresh it it is my low cpu alarm and it has triggered because the cpu of my ec2 instance is 2.5 which is less than 30. now it has triggered that alarm what what auto scaling group is doing so it has triggered the alarm watch i'll click refresh in here even before i refresh one thing we can do is um if you go to auto scaling groups and i know we are almost at time so give me like five minutes we are almost done with this so if you select your auto scaling group right um no i'm on target group sorry so i go to auto scaling group you select your auto scaling group your auto scaling group as an activity so you can see the activity here you can see right now the latest activity is it is terminating one ec2 instance and it first it would drain the apple uh the application load balancer so it won't be able to route traffic to that ec2 instance before it removes it that's why it is taking time but eventually when um this see right now is saying waiting for the application load balancer to drain the connection meaning that is waiting for the application load balancer to remove that ec2 instance from the connection of the ec2 instance is going to be routing traffic too once that is done the auto scaling group would remove this ec2 instance so that draining part is what is taking long now but eventually because we have it has triggered the alarm that says remove one ec2 instance if the cpu utilization is less than 35 and we also have some scaling policy where we have the minimum we want is one so what it would do is it will remove one ec2 instance so i know the draining part takes long because it takes some time to drain it from the thin before it removes it but eventually it would remove one ec2 instance does anyone have any question i know this was kind of like a lot was it a lot for today or today remember the main thing we did is we register for a domain name we set up our ssl on port 443 and we create an auto scaling group to scale up our ec2 instance based on our desired capacity and the scaling policy we just created so those are the three things we did today does anyone have any question while i'm waiting for this to drain are you guys still even here because it's very quiet okay yes we are okay yes i am i'm here right here all right cool all right this brings us to the end of the project this is project two done in the bag right now the question you should be asking yourself is how much do you know about this project too do you understand every single thing we've done up to this point remember you see our site is working this is something always getting in the way um you can see our site is working it is fully encrypted now if i can give you guys this site you guys can type aos class.com on your site you'll be able to access this site just any site you guys are accessing online it could be deployed this way there's different method of deploying sites but one of this is one of the methods so let me see this thing why it always takes forever to drain that application load balancer but this is what is delaying it because here under the activity it is still draining that ec2 instance you can see it is waiting for the application load balancer to do that so once it has finished draining it meaning that application load balancer will remove one ec2 instance from the the easy to instance it wants to be routing traffic too once that is done the auto scaling group will come here and delete one of this so when you guys test this in your when you are working on it make sure you wait for it to drain it and remove it i know it is taking time but there you go see it has removed that one of those easy to instance and if i remove my filter you can see my auto scaling group ec2 2 terminated this is because of the scaling policy i just created that's what i wanted to show you guys so this is how you can dynamically scale up and down so now let's say this site is just here people would start to access it now now more people are coming the cpu utilization on that one ecto-instance that is running will continue to rise and when it rises past 80 percent which is what we put for that scaling policy the auto scaling group will create another one so that is how you can dynamically scale up and down without wasting money so that is the end of this class and the end of this project make sure you understand everything we did up to this point because friday we are going to briefly recap this and we are going to start our next project but on friday you are going to be creating a vpc with six subnets and two different availabilities on three in one availability zone three in the other one your knowledge should be at the point where you feel comfortable creating a vpc by yourself i'll still give you all the steps and all that stuff but you should be getting closer to if not there but feeling comfortable that you can create a vpc by yourself so that is it for this class and this project i will send you guys the recording does anyone have any questions before we leave [Music] okay no questions all right thanks thank you guys and i will see you on friday all right all right take care all right thank you thank you bye you
Info
Channel: AOS Notes
Views: 283
Rating: undefined out of 5
Keywords: AWS, awsnotes, aws class, aws tutorial for beginners, aws certification, aws tutorial, aws training, aws for beginners, aws, aws solution architect certification, amazon web services, aws cloud, aws training for beginners, amazon aws tutorial, what is aws, what is amazon web services, aws certification training, aws training videos, aws services, simplilearn, cloud computing, aws certified solutions architect, amazon web services tutorial for beginners, aws basics for beginners
Id: _C9k3rme0AM
Channel Id: undefined
Length: 114min 1sec (6841 seconds)
Published: Wed Jun 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.