AWS Load Balancer and AWS Target Groups Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back in this tutorial i'm going to show you how to set up load balancers and target groups first we will create an ec2 instance to run our server then we will create a target group and a load balancer throughout http traffic if you're completely new to load balancing i highly recommend you watch our aws elastic load balancing explained video the links is in the description otherwise i'll explain every single step as we go a load balancer allows you to control all your incoming traffic target groups are a collection of one or more ec2 instance for your application by setting target groups and a load balancer you could route your http traffic to a single or multiple instances if you're running multiple instances inside your target groups and let's say one of them fails you don't have to worry much as your load balancer will always draw traffic to a healthy instance when you create a load balancer you will get a unique dns name it's an a record that's basically equivalent for your ip address instead of routing traffic to your server public ip you would use your load balancer unique dns name it's also worth mentioning that if you're going to map your domain name to your server instead of using your server ip address you would have to use your load balancer dns name we're going to create two security groups one will allow our ec2 instances http access and the other one will give ssh access so we could remotely connect to our instance on the top search for ec2 on the left you want to scroll down and you want to go to security groups under network and security and let's go ahead and create our new security group and i'm going to call this internet access and for the description i'm just going to write internet access as well and we're going to open two ports http and it's optional if you want to add https but for this demo i'm not really setting up an ssl certificate at all so i'm just going to leave that so for the http we want to make sure that we can connect anywhere and let's go ahead and create this new security group now let's go back to security groups and create another security group and this one will just say developers ssh access and for the inbound rule i'm going to select ssh and i'm going to select my ip address let's go ahead and create this security group now once you have both of these created let's go ahead and add a name for them so for the internet access i'm going to add it in the label here and for the developers ssh access i'm going to also add the in the name here now for our second step we're going to create our ec2 instance so let's go to instances and from here let's launch a new instance and this is just for a demo purpose so i'm going to select ubuntu and i'm going to keep it micro and let's go ahead and go to security groups and add our security groups for developers ssh access and the internet access and let's go ahead and launch our instance and i'm going to create a new key pair and let's call this server 1 test and let's go ahead and launch our instance now once your instance is up and running let's go ahead and give it a name i'm gonna call this test server one and let's go ahead and copy our ip address and now i'm going to quickly ssh into my instance and i'm going to install apache just to demonstrate that we have a server up and running so i'm gonna use get bash here and we're gonna use ssh so ssh and we're gonna specify the file it was called server test one pem and ubuntu add and we're gonna paste our ip address now i'm going to update our server so we're going to run sudo apt update then we're going to install apache tool and our last step i'm going to also install php for our apache so we do that by writing sudo apt install php then we're gonna write lib and then apache2 dash mod dash php and now i'm just going to quickly restart our server so we're gonna restart apache and let's go ahead and exit our terminal now inside our browser let's go ahead and double check if apache is installed so we're going to copy our ip address and we're going to connect to it using http only and you can see here we have our default apache page before we create our load balancer we will create a target group then we will assign our ec2 instance to that group so we're going to register our ec2 instance after all that we will create a load balancer and we will redirect our http traffic to our target group so on the left here we're gonna scroll all the way down and you're gonna see here target groups let's go ahead and create ourselves a new target group and we're gonna select a target type instance there is all these different types here you could use for the target group name i'm just gonna call this test demo now i'm going to also keep the http protocol since we're not really using https for this demo and here you could create all your health checks the first field here health check path what this will do is basically it will send a request like an http request to your server then if your server responds with 200 it will basically report healthy now here you could modify all your values for example you could set the interval between each check the success code here is 200 you could change that and you have unhealthy threshold targets how much times it can fail and the number of consecutive health succeeds before it's uh considered unhealthy so you could modify all your values here let's go ahead and keep the default options and click next now we're going to register our ec2 instance to our target so now once you select your ec2 instance or instances you're going to click on include as pending pillow and let's go ahead and create our target group now our last step is to create a load balancer so on the left inside ec2 instances you want to scroll all the way down under load balancing click on load balancers and let's go ahead and create a new load balancer and we're gonna select the application load balancer we covered all these in my previous video and for our load balancer name i'm just gonna call it demo test now for the scheme you have internet facing and internal so the internet facing will give you both an ipv4 ip and it will give you a private ip for the internal you will not have a public ip which means that no one will be able to access it globally and for the network mapping i'm going to select all my available options here and let's go all the way down and here is what we want to do so we want to listen on http port 80 and we want to forward all those requests to our test demo target group and now let's go ahead and create our load balancer now it's gonna actually take a while but eventually once your load balancer status become active then we're ready to use it down here you have your dns name so you would use this name instead of your ip address to connect to your instance so let's go ahead and see that now this is not gonna work and you can see here it's stuck loading and eventually it will time out and the reason is we haven't really added security groups to our load balancer so we will need to set our security groups here so let's go ahead and edit our security group and for our load balancer i'm gonna only select internet access which will allow people to connect to our load balancer using our url and you can see here this site cannot be reached so let's go ahead and add that and let's uh refresh and now you can see that our load balancer is working thank you for watching if you found this tutorial useful then i would appreciate it if you hit that like button otherwise make sure you subscribe to our channel to stay up to date with our latest training videos if you have any questions feel free to post it down on a comment below and we'll see you on the next video
Info
Channel: AHT Cloud
Views: 521
Rating: undefined out of 5
Keywords:
Id: DxwXBobFiNI
Channel Id: undefined
Length: 11min 48sec (708 seconds)
Published: Mon Oct 04 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.