For previous setup info see my post on setting up instances using Chef and AWS: HERE
If you have completed the steps in the previous post you can repeat them a few times to spin up 3 or more instances. For this post lets assume I have spun up 3 instances named web001, web002, and web003.
1. In your AWS control panel navigate to your EC2 instances and on the left hand column click “Load Balancers” under “Network and Security”.
2. Click the “Create Load Balancer” button at the top.
3. Define Load Balancer Enter a name for your LB and for this example use “EC2-Classic”. By default port 80 is being monitored and since we have 3 web servers running httpd this will be all we need. Click Continue.
4. Configure Health Check For this example the only thing that you need to change is PING PATH. Change it to just “/” dropping the index.html that is already there. Leave everything else the way it is. Continue
5. Add Instances to Load Balancer Check off your 3 instances. Leave the settings for Availability Zone Dist as they are. Continue
6. Keys Here you can create a key and value pair for your load balancer. For example, you could define a tag with key = Name and value = Webserver. Continue
7. Review This will give you a run down of your load balancer before you create it. Click CREATE and it will be started up.
Once your LB has been started it will take a couple of minutes before your instances are in service. If you click the name of your LB you can see the description tab below. Wait a couple of minutes and then copy the DNS Name which should be the first line that ends with (A Record) Ex. LB-001-201566711211.us-east-1.elb.amazonaws.com Paste this into your browser and you should see your webpage that you created in your instances.
You have 7 tabs that contain information about your loadbalancer.
1. Description DNS Name can be found here along with brief info on the status fo the instances connected to this LB
2. Instances Status of the instances that are connected to the LB. You can also drop the instance from the LB here
3. Health Check The main thing to watch here is “Unhealty Threshhold” You can also edit the Health Check settings here.
4. Monitoring CloudWatch metrics for the selected resources. You can also create alarms for your instances on this page.
5. Security Displays your security groups that are connected to this LB
6. Listeners The ports and protocols you are listening for on your instances.
7. Tags Tags that you created when setting up the LB and you can also create more from this page as well
This is a VERY basic run down of how to create a load balancer in Amazon AWS. If you have any questions or input feel free to use the comment section below.