Saturday, February 22, 2020

AWS 04: Construct HA web server environment (Classic Loadbalancer)

Let's see how we can construct high availability web server environment with the use of Loadbalancer on AWS.

The environment would be like below:


The users http requests is to be handled by Loadbalancer (WebLB01) which is exposed to public internet, and the handled requests passed to member servers under the Loadbalancer.
As two web servers are assigned, any visitors will not be affected even if one of them goes down.



First of all, two web servers must be prepared, it would be achieved by creating instance from the AMI image of previous session.




Let's take a look each steps of provisioning of Loadbalancer.
  1. Check required instances and RDS are ready for this tutorial.
  2. Navigate your self to "Load Balancers" section on left pane of EC2, and hit create "Load Balancer".
  3. Select Classic Loadbalancer for this time.
  4. Define Loadbalancer name, open HTTP port and assign subnets.
  5. Assign security group.
  6. Health check configuration uses default setting.
  7. Assign EC2 instances to the Loadbalancer.
  8. Make sure the Loadbalancer is facing to the internet.
  9. After provisioned Loadbalancer, it would take a while the status of assigned instances to be availabled. Be patient.
  10. After the instances get inservice status, you can check how the Loadbalancer allocate requests to each servers.
  11. One important thing is that classic Loadbalancer do not keep the session on default. So that you need to set "stickiness" to be enabled.
  12. Navigate yourself to Loadbalancer page and find "Port Configuration" on "Description" tab.
  13. Hit "Edit stickness", then tick "Enable load balancer generated cookie stickness.
  14. You finally see the Loadbalancer handles web session.
  15. And also try to shutdown one of EC2 instance, and see how the requests to be handled by Loadbalancer.


Please take a look an actual operation on following video.




No comments:

Post a Comment