An important reason to use a cloud is to achieve scalability at a relatively low cost. Load balancers play a key role in scalability. We can attach multiple instances behind a load balancer to distribute the traffic between the instances. Google Cloud load balancer also supports health checks which helps to ensure that traffic is sent to healthy instances only.
Managing load balancer
How to do it...
Let us create a load balancer and attach an instance to it:
- name: create load balancer and attach to instance
gce_lb:
name: loadbalancer1
region: us-west1
members: ["{{ zone }}/app"]
httphealthcheck_name: hc
httphealthcheck_port: 80
httphealthcheck_path: "/"
service_account_email: "...