CentrioHost Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog


Elastic Load Balancing With EC2 instances

A load balancer receives the incoming requests from clients and transferred that’s requests to its registered targets in Availability Zones.Each targets contains EC2 instances. The load balancer always reviewing the health status of its registered targets and ensures that clients request transfer to healthy targets. If the load balancer detects an unhealthy target or EC2 instances, it stops routing the requests to that target or instances,

In order to connect the Amazon EC2 instance, you need to create .pem key pair for a each instance.it can be created via Amazon Ec2 console. Suppose, you have already key pair in your hand.Then, you not need to create new one. You can easily use that old key pair to new instance.

To create and launch a new EC2 instance

1.login to your Amazon EC2 console at https://console.aws.amazon.com/ec2/.

2.Click on Launch Instance options in EC2.

3.Choose an Amazon Machine Image (AMI) : you can see there top AMI provided by AWS. Each AMI is template that contains software configuration for launching instance

4.Choose an Instance Type : Amazon provides many instance type as per our requirements. The instance type variation depends on CPU number , memory, storage capacity, and networking capacity, So, you need to select on as per your running application on new instance. The defaults one is t2.micro ( 1 cpu, iGb memory..etc)

5.Configure Instance Details : we can manually configured our instance configuration. Also, amazon provides a option to configured the multiple instances with same AMI. All instances are launched on virtual private network(vpc). You are able to configured it in custom way. If not, Amazon EC2 will take defaults vpc with subnets while try to create a new instances.

6.Add Storage :The defaults volume size is depends on instance type that you have selected. If you need to add more, you can add it as per our needs.

7.Add Tags.It like a instance name that will help us to identifying the instance in easily.

8.Configure Security Group: The Security Group acts as instance firewall that control all traffic to new instances. For proper working of instance , you needs to add all required rule in it thats means, you needs to open ports in security groups.

8. Review Instance Launch: you can see the summary details of new instances configuration that you are wish to launch.

9. Click to launch option and download .pem key pair to connect instances from terminal

To configure the load balancer in AWS, we needs to configured the two instance with t2.micro instance type. Now, we have done it using above steps.

Instance1:
IP:18.222.192.75
Hostname: www.example.com
keypair:example.pem

Instance2:

IP:18.222.230.136
Hostname: www.text.com
keypair:text.pem


Instances

To access your instance1:

# chmod 400 example.pem
# ssh -i "example.pem" ec2-user@ec2-18-222-192-75.us-east-2.compute.amazonaws.com
# sudo su -

To access your instance2:

# chmod 400 text.pem
# ssh -i "text.pem" ec2-user@ec2-18-222-230-136.us-east-2.compute.amazonaws.com
# sudo su -

After accessing of your current instance, Please install Apache software package and enabled it on port no 80. we have suggested you to create a sample index page and confirmed that that sample page is loading fine while you are browsing your server ip in local browser. Also, you need to check Apache error log if you are facing any issue.

# yum install httpd

As like we early said, we have installed it and created sample index page for both instance like “HELLO WORLD , HELLO FRIEND”. Both pages are loading fine with out any issue.

To configure Load balancer for EC2 instance

1. login to aws console at https://console.aws.amazon.com/ec2/. and select a load balance creation options.

2.Select load balancer type: Elastic Load Balancing supports three types of load balancers: Application , Network and Classic Load Balancers.Application load balancer has flexible feature set for your web applications with HTTP and HTTPS traffic. So, we have select that to configure.

3.Configure Load Balancer: please provide a new load balancer name, enabled Listeners ports like https and select a vpn network. If you are not configured in custom way, it will automatically takes defaults vpc network configuration . You can select only one subnet per Availability Zone. We recommended you to select subnet same as in instance’s subnet.

4.Configure Security Groups: it same as in firewall rule to control the load balancer traffic. Its will be a better option to select load balancer security group same as the security groups’s of each instances.

5.Configure Routing and Register Targets: please create new targets group and registered the both instance to this targets group and create load balancer


Load Balancer

After successfully create load balancer, you may try to browse your load balancer URL name in private window random-ally, you can see the two instance index page will change in each refresh. Thats means load balancer is properly configured for each instance.

 

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar

SatSunMonTueWedThuFri
 1
2345678
9101112131415
16171819202122
23242526272829
30 

Over 20000 Satisfied Customers!

  • web hosting reviewer
    Valerie Quinn
    CTO, Acteon Group

    Centriohost staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue! ~ . . . Read more

  • Joomla hosting reviewer
    Collin Bryan
    Photographer, Allister Freeman

    I'm using centrio for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly. ~ . . . Read more

  • dedicated server reviewer
    Harry Collett
    Actor, A&J Artists

    Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all. ~ . . . Read more

  • vps web hosting reviewer
    Porfirio Santos
    Technician, Diageo PLC

    Centrio support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Centriohost have been amazingly responsive and helpful to any of my queries 👍👍👍 ~ . . . Read more

  • wordpress hosting plans reviewer
    Catherine Auer
    Doctor, SmartClinics

    Anytime I've had a problem I can't solve, I've found Centriohost to be diligent and persistent. They simply won't let an issue go until the client is happy. ~ . . . Read more

  • reseller hosting reviewer
    Effectivo Social
    Freelancer, Fiverr

    Recommend their shared hosting for all my SME web design clients. Their cloud or VME offerings are too great to deal with. Pricing is perfect and suitable for all users (͠≖ ͜ʖ͠≖) 👌 ~ . . . Read more

Top