How to do it...

We can create and test a classic load balancer as follows:

  1. Go to the EC2 service in the console.
  2. Click on Load Balancers from the left sidebar.
  3. Click on Create Load Balancer. We should see the options to create the three types of load balancers, namely application load balancer, network load balancer, and classic load balancer. Classic load balancer is currently marked as a previous generation and is grayed out.
  4. Under Classic Load Balancer, click on Create.
  5. For Load Balancer name, provide a meaningful name. Leave the other options with their defaults:

  1. Click Next: Assign Security Groups.
  2. Select a security group that allows HTTP from 0.0.0.0/0. You may use the MyWebServerSG security group that we created in the Using EC2 user data to launch an instance with a web server recipe in Chapter 6Working with EC2 Instances
  3. Click Next: Configure Security Settings.
On the Configure Security Settings page, we will get a warning that our instance does not use an HTTPS or SSL protocol for frontend encryption. We will learn how to use HTTPS with ELB in the Using an application load balancer with TLS termination at the ELB recipe of this chapter.
  1. Click Next: Configure Health Check.
  2. On the Configure Health Check screen, we will use the defaults:

  1. Click Next: Add EC2 Instances.
  2. On the Add EC2 Instances screen, add the two instances and for other options, use the defaults:

  1. Click Next: Add Tags and add any tags for the ELB (this is optional).
  2. Click on Review and Create.
  1. Review and then click on Create. Initially, we will see the Status set to OutOfService while the instances are being registered:

After the instances have been registered, the Status will change to InService.

  1.  Copy the DNS name from the ELB's Description tab and run it from a browser:

Every time we run the URL, we will get a response either from web server 1 or web server 2.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.74.66