Now let’s learn about load balancing.
And a question you may have is what is load balancing?
Well, a load balancer is going to be a server or a set of servers that will forward traffic that is received to multiple backend or downstream EC2 instances or servers.
So the idea is that for example, we have three EC2 instances and they’re going to be fronted by an elastic load balancer, which is a set of servers behind the scenes.
Now, what happens when you have, for example, three users directly connecting into your elastic load balancer?
Well, the first one is going to have its load being sent in one backend EC2 instance and because there’s load balancing well, if another user is connecting to your elastic load balancer then it will be sent to another EC2 instance.
And then finally, while if a third user is connecting to your elastic load balancer, that user will again be load balance and sense to the third EC2 instance.
So the idea is that the more users you have, the more the load is going to be balanced across EC2 instances.
But the idea is that your users do not know which backend instances they’re connected to.
They just know that they have to connect to your elastic load balancer, which gives them one end point of connectivity only.
Now, why should you use a load balancer where you spread the load across multiple downstream instances, you’re going to expose a single point of access to your applications as I just said.
You’re going to seamlessly handle failures of downstream instances because the load balancer will have some health check mechanisms and can understand to which instances and cannot send traffic to.
You can do health checks on your instances.
You can provide SSL termination.
So if you have HTTPS encrypted traffic for you websites, you can enforce stickiness with cookies, high availability across zones and separate public traffic, from private traffic on your cloud.