Shared Load Balancer for many ElasticBeanstalk apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
a share load balancer can help you to reduce costs and easily set up an SSL certificate for your applications on elastic and it can be a really good approach especially for testing applications and environments [Music] hello everyone this is Marco speaking today you will learn how to set up a shared load balancer on elastic Beanstalk so you can use the exact same load balancer for multiple applications use a host based routing which means that we're gonna use different hosts for routing to different applications let's say for example that we have the first host which is going to be for example www.myapp1 dot mydomain.com this host is going to is going to route to the first application and if we have a www.myapp2.mydomain.com is going to route to the second application and if you have a www.myf3.mydomain.com is going to host to the third application and so on so you can host many applications using this the exact same shallow bouncer in your elastic install applications so let's do this but before we proceed if you like this kind of content just give me a thumbs up share this video with your friends and subscribe to the channel so you can learn more about AWS ecosystem and don't forget about it the more you learn the better will become and more value can provide so let's do this also before we proceed it's important to mention that you must have a domain and a hosted Zone on AWS so in my case for example I have a domain here on Route 53 and I also have a hosted Zone you can buy a domain inside the AWS console using the raw 53 and the domain section on the registered domains or you can buy the domain outside from AWS and then you then create a DNS records point to a hosted Zone inside AWS so in my case I bought a domain outside of the AWS but I pointed to AWS infrastructure and then I created the hosted Zone here so this is the domain that I bought for making the experiments mpsj.online okay perfect so now we need to know that for keep going you must buy a domain and you also must create a hosted Zone on AWS perfect let's keep going so the first thing that we need to do is to actually create the load balancer so let's do this let's go to the ec2 console we go here and then we search for the load balancer section you can if you don't find it you can go to the left section and then search for load balancers and then let's create a new load balancer I'm gonna use an application load balancer the first kind here I'm gonna call it shared load balancer perfect so here I'm going to select three availability zones for deploying our applications I'm going to select Us West 2A 2B and choose C for having a highly resilient application you must have at least three it's recommended for you to have at least three availability zones so let's keep going and then for the Target group for now I don't have a Target group here I'm going to create a default Target group I'm gonna call it I'm gonna click here so I'm gonna basically route to the instances I'm gonna say that this is the default Target group for shared apps this is up to you next for now I'm not going to select any instance running on this issue I'm just gonna create a Target group to be the default Target group for the load balancer let's refresh it here and select it here perfect let's keep going perfect in a few minutes we're gonna have our share a little balancer which is going to be used for multiple applications on elastic Beanstalk it is provisioning but in a few minutes it will be ready for usage okay perfect after a few minutes our load balancers is active and ready to use so let's do something I'm going to click here I'm gonna change the rules to use https instead of HTTP so I'm going to create a new listener here Point using the https protocol on Port 443 and this one is going to it's going to forward the request to the default Target group perfect and the policy I'm going to select this one yes this one is going to work for us I'm going to click it here and for the certificate you most also create a certificate on certificate manager so you can go to certificate manager on AWS and the integrated Stitch certificate and then you add an entry for your certificate on the Route 53 hosted Zone so after creating the certificate and pointing it to the to the hosted Zone you can use it here on your load balancer so in this section here I'm going to select my certificate the directory from certificate manager to the load balancer so this is going to allow us to have https rather than HTTP for our applications perfect let's keep going I'm gonna add this this listener and for the default listener on Port 80 what I'm going to do sorry I'm gonna I'm gonna click here I'm going to click to edit listener and I'm gonna forward the request from Port 80 to Port 443 so whenever someone tries to use HTTP the application will be redirected to https so all requests to our load balancer will be secure so what I'm going to do here I'm going to redirect everything from Port 80 to Port 443 perfect so whenever someone tries to use HTTP it's going to redirect to https so all routes will be secure and then we save the changes perfect let's go back to the load balancer and now I have the two listeners here now that our configuration for the load balancer is complete let's go back to elastic Beanstalk so I'm going to search here for elastic Beanstalk and then I'm going to create a new application I'm going to call this application of mpcsg shared app so so this is since this is the application you might see some things slightly different so I'm going to select here to use the docker platform and then let's click to configure more options so I'm gonna show you something we go to the capacity section we have to switch from single instance to load balanced for our environment and then we'll click just save and then we go to the load balancer section so if the option of just switch between dedicated and shallow balancer is not showing up to you it's probably because this is the first application that we're creating and then in this case I have to cancel go back and click to cancel again but in this case we have the the the application that we created so we click here and then we click to create a new environment rather than create a new application so a click to create new environment and it's going to be your web server and then we call this this is going to be the shared app one environment and in this case we're going to select Docker again to the platform and then here click to configure more options perfect on the capacity section we click to edit just like we did before and then we'll switch here to load balanced and then I click to save and then we search for the load balancer section we click to edit and now we can see the dedicated and shared load balancer previously we couldn't see this because we were configuring the first environment for the application and this is so if that situation happens to you just cancel it and then use the same application to create a new environment rather than create an application so you will see the dedicated and shared options to use the load balancer in this case we're going to switch this to shared and down here we select the the load balancer that we created previously for The Listener we're gonna we're gonna use the port 443 because we want the application to have https rather than HTTP for making the call secure perfect let's go to the rules section so what we're going to do we're going to create a new rule I'm going to call this route to app one and I'm gonna switch this to host header so whenever someone tries to do a www.shared F1 Dot mpcsj.online which is my domain on Route 53 and whenever smart tries to do the same but without the www it's going to route to this application perfect and then I click to add make sure here to use the listener on Port 443 rather than 80 for heavy secure calls and then that's it and then I'll click just save perfect now let's click to create our app create environment sorry perfect in a few minutes our app will be complete and ready to use okay perfect after a few minutes I'll replicate our application is ready to use on elastic Beanstalk and then if you go here on configuration section foreign scroll to the load balancer we can see the the sub domain that we defined for this app shared F1 so I'm gonna copy this I'm gonna go to Route 53 then we click here we go to our hosted zone for this domain in my case is the mpcsj Dot online and then here I'm going to create a new record I'll click here and then this is going to be the sub domain since we're pointing to a elastic Beanstalk application we're going to switch this to alias and then we select elastic B stock here on the list which is the region which is Oregon my case and then I select the environment which is the one that I've just created and then I click to create a new record perfect in a few minutes our domain will be ready to use okay perfect now that our domain is ready to use let's go back to it and this is the whole domain let's copy this and paste this on the browser if you can't use it just like in this case for example it's gonna load forever but the app won't be able to access it so if this situation happens to you what you need to do you need to go back to ec2 and then we search for the load balancer that we are using click here this is the load balancer and then we have to go to the security section and then we go to the security group that we're using for example this Security Group for the load balancer and then what we need to do we need to enable the access on Port 443 for this load balancer otherwise all otherwise the browser won't be able to access the application because the port 443 is closed to be accessed so we click to edit inbound rules on the security group and then we add a new rule to https https from anywhere so if you want to add a description here I'll now secure access to the app this is optional you don't need to put this then I click to save a rule and then here we refresh the page perfect now we can access our application use the shared load balancer as you can see here and we also have https if we can see the lock here showing that our application is secure on elastic install let's create a new application to demonstrate that we can create many applications using the same load balancer this is going to help you to save a lot of money on the last install so let's go back to elastic B stock foreign and then here this is our application let's create a new environment it's going to be a web server again but this is going to be the shared F2 and this case I'm going to use a node.js application then I click to configure more options and then we go to the capacity section here we switch from single instance to load balanced and then you click just save and then here on the load balance resection let's search for it here we click here again we switch to Shared load balancer and then we point to the same load balancer on Port 443 and then it'll create a new rule I'm going to call this route to shared F2 and it's going to be a host header again which is going to be www.shared app2 or the same without the www and then we add oh sorry I switched this to host header and then click just save oh sorry I forgot my sub domain dot mpcsj dot online and then here an mpcsj Dot online perfect let's click to add perfect now let's let's check it again we're using the listener on Port 443 and then we click just save and then I'll click to create an environment you know what I'm gonna do the same but now it's going to be a python application so you're gonna have three different apps use the same shared load balancer let's click here why the second one is being created let's create a third one web server this is going to be uh have I selected the same app let me check applications create an environment on the same application and then this is going to be the shared app3 this is going to be a python app with figure more options capacity with switch to load balanced click just save and then on the load balancer again we click here we switch to Shared load balancer select the shallow balancer on board 443 add a new rule route is going to be called route to Shared F3 is going to be a host header www.shared f3.mpcsj Dot online and the same but without the www then click to add and that looks like just save and then here click to create an environment perfect in a few minutes our two apps will be ready to use and we're going to set up the subdomains on Route 53 just like we did for the first the first one okay perfect after a few minutes are the two new apps that we created are ready to use so we can see it here this is the node.js app and the other one is the python app so what we're going to do we're gonna go back to the to the Route 53 and to the hosted Zone then I'm going to create the new record to the second app which is the shared two and we can switch this alias elastic Beanstalk Oregon this is going to be a shared app true like to create a new record and then we do the same for the third one shared F3 switch to alias elastic Beanstalk organ and this is the F3 then I click to create the record perfect in a few minutes both domains will be ready to use okay perfect after a few minutes let's try let's go back to the browser I'm gonna search for shared app 2.mpsj.online and perfect we can access the second application which is the node.js application that created on elastic Beanstalk and then let's try to see the third app which is the python app we switch this to shed F3 and perfect this is the third app that we created with python so now we have three applications three different applications on the last B stock use the same shared load balancer helping us to save costs and to easily set up the load balancer for our applications if you like this kind of content just give me a thumbs up share this video with your friends and subscribe to the channel I hope you liked it and I'll see you in the next time
Info
Channel: Mpcsj Tech Tips
Views: 793
Rating: undefined out of 5
Keywords: amazon web services, aws, cloud, load balancer, shared, shared load balancer, elastic beanstalk, shared load balancer elastic beanstalk, software, cloud computing, costs, ssl, https, http
Id: XhGc_IM959A
Channel Id: undefined
Length: 20min 7sec (1207 seconds)
Published: Tue Feb 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.