[Recipes] Elastic Load Balancing With Amazon EC2

Problem: 

Elastic Load Balancing supports two types of load balancers: Application Load Balancers (new) and Classic Load Balancers. Demo the use of both.

Solution Summary: 

First we will create and demo classic load balancer and then we will create application load balancer.

Solution Steps: 

  1. Login to AWS console and go to EC2 dashboard page.
  2. Start your EC2 instance which renders a page using the httpd service (refer to previous labs).
  3. Login through ssh and verify if httpd is running and the insex.html file is present (refer to previous labs).
  4. Click on ‘Load Balancers’ under ‘Load Balancing’ side tab.
  5. Click on Create Load Balancer. You should get options for creating two types of load balancers: Application Load Balancers (new) and Classic Load Balancers.
  6. Click on classic load balancer
  7. Give a name (e.g. BuddyClassicELB)
  8. Select My Default VPC.
  9. Leave other options unchecked (create an internal load balancer, enable advanced vpc configuration, Listener configuration). Verify that HTTP is available under Load Balancer Protocol.
  10. Click next and add it to BuddyWebDMZ security group ( created before with EC2).
  11. You may get an error message as you are not using HTTPS; you may ignore it. Click next.
  12. Configure Health Check. Leave Ping Protocol as HTTP, Ping Port as 80, Ping Path as /index.html, Response timeout as 2, Interval as 30 seconds, Unhealthy threshold as 2, Healthy threshold as 3. Read the info alongside all options to understand what they do. Click next.
  13. Add the EC2 instance. Click Next.
  14. Add tags to monitor charges in the account (e.g. BuddyProductionELB with value ON). Click next.
  15.  Review and create. Click close on the success message and review the newly created ELB like the Health Check tab. You also need to wait until your EC2 status is ‘InService’.
  16. Copy the DNS and run it on browser to see your index.html page loaded.
  17. Simulate a failure by deleting or renaming the index.html file in the server through ssh. In few seconds, you should see your instance status as ‘outOfService’ in ELB dashboard. This can be a hack for taking an instance out of service, and once status is ‘outOfService’ ELB will not send any requests to it.
  18. Restore the index.html file and make sure EC2 status is ‘InService’.
  19. Click on Create Load Balancers.
  20. Select application load balancer.
  21. Give a name (e.g. BuddyApplicationELB). Leave scheme as Internet facing. Leave the HTTP listener as is. Use default VPC. Click Next
  22. Click next as we are using only HTTP.
  23. Add to our security group.
  24. Configure Routing: Select New Target Group, Give a name (e.g. BuddyAppELB), leave port as 80. For health check leave protocol as HTTP, path as /index.html. Leave port as traffic port. Leave thresholds, interval and and timeout as before. Leave status code as 200. Click next.
  25. Configure Target: Add our server by selecting and clicking ‘Add to Registered.’
  26. Review and create. Click close on the success message and review the newly created ELB like the Health Check tab. You also need to wait until your status is ‘active.
  27. Explore various options and metrics.
  28. Copy the DNS and run it on browser to see your index.html page loaded.

Comments

lijo's picture

service httpd status

 

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

CloudMaterials.com is my latest blog to share my notes and learning materials on Cloud and Data Analytics. My current focus is on Amazon Web Servivces.

I like to write and always try to document what I learn. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream

,