250 likes | 260 Views
An ELB is a software-based load balancer which can be set up and configured in front of a collection of AWS Elastic Compute (EC2) instances. The load balancer serves as a single entry point for consumers of the EC2 instances and distributes incoming traffic across all machines available to receive requests.
E N D
DevOpsCheetah Home Linux Cloud Programming Monitoring CI/CD Categories Create LoadBalancer in AWS June 2, 2021 Atul Rajput 0 Comment Today we are going to learn “How to create LoadBalancer in AWS” An ELB is a software-based load balancer which can be set up and configured in front of a collection of AWS Elastic Compute (EC2) instances. The load balancer "Cookie Settings" to provide a controlled consent. We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit Cookie Settings Accept All
serves as a single entry point for consumers of the EC2 instances and distributes incoming traffic across all machines available to receive requests. AWS has three types of load balancer:- 1. Classic Load Balancer (This is previous generation load balancer) 2. Network Load Balancer (This load balancer is used to low latency because it works on layer 4) 3. Application Load Balancer (This load balancer works on layer 7) Now we are going to create ELB (Elastic Load Balancer) in AWS In the previous blog, we described “How to create an EC2 instance”, please follow this link https://www.devopscheetah.com/how-create-an-ec2-instance-on-aws/ But we need minimum two instances and two subnets for load balancer to divide or balance the load. Scroll down the left side slider you will see the load balancer and target group.
First we have to create target group in which we define the instances for the load balancer. Click on Target groups.
Now click on create Target Group Define the details Target Group Name = EMT-TG (Appropriate Name) Target Type = Instance (which we want to target) Protocol = HTTP (we are working web app) VPC = EMT-VPC (define the VPC) Health check settings Protocol = HTTP (define the protocol as per the requirements) Path = / (If you want define another page we can define)
Now click on the targets and define those instances which you want to add Now click on the edit and select instances and click on add to register
After clicking on add, you will see those instances in registered targets on the top,
Now click on save and you will see this image Now click on load balancer and create Load balancer
Now click on create load balancer and select “Application load balancer” You will get this image
Define the details Name = EMT-ELB (load balancer name) Scheme = Internet-facing (where you want to balance load through internet or internally) IP address type = IPv4 Listener = HTTP (HTTP for non secure or HTTPS for secure) VPC = EMT-VPC AZ= define the subnet with AZ Now click on next Configure security settings, you will see this message
Because we are working on HTTP not HTTPS. Click on Next Configure Security Groups
You can create new or select existing security group for security point of view create another security- group for ELB. But we are using existing groups. Now click on configure Routing and you will see this image
Define all these details Target Group = select existing group Name = EMT-TG After this it will select all the details automatically which we defined in the target group. Now click on Register Targets and you will see this screen
Now click on next: Review Now click on create and finally your load balancer is created.
Now we will login in an instance via gitbash-tool, This is the git bash terminal
Now we have to log-in to instance Run this command ssh -i Downloads/EMT-TOK.pem centos@ ssh -i key-pair location(Downloads/EMT-TOK.pem) centos(user)@public-ip(54.199.190.114)
Run this command (su -i) convert centos user to root user. su -i After this install httpd service yum install –y httpd
When successfully installed run these command systemctl start httpd systemctl enable httpd after this edit welcome.conf file (This is default welcome file of HTTP(Appache) location of welcome.conf file /etc/httpd/conf.d/welcome.conf run this command to edit the file vi /etc/httpd/conf.d/welcome.conf
Now create your own html file under this directory (/war/www/html/) vi /war/www/html/emt.html Now add a line in the file “ WELCOME TO EMT” and save it. Restart the httpd service Systemctl restart httpd Note:- Do the same things in another instance. Again go to load-balancer and copy the dns name
Enter that url and get result Now your load balancer is ready and working is fine, if you face any issues please let us know ? . If you want learn “How to create an EC2 instance” please click on link given below:- https://www.devopscheetah.com/how-create-an-ec2-instance-on-aws/ Tags: AWS loadbalancer , Classic loadbalancer in AWS , Loadbalancer in AWS Leave a Reply
Your email address will not be published. Required fields are marked * Comment Name * Email * Website Save my name, email, and website in this browser for the next time I comment. POST COMMENT Previous Post Next Post
Related Posts Blogs About Us Contact Us Privacy Policy © 2021. DevOpsCheetah.com PDFmyURL.com - convert URLs, web pages or even full websites to PDF online. Easy API for developers!