--- title: "Connect a load balancer" description: "Put a TIR Auto Scaling Group behind a Web traffic load balancer so requests reach every VM of the group, and detach it again from either side." content_type: "how-to" product: "tir-auto-scaling" platform: "TIR" url: "/tir/tir-auto-scaling/how-to/connect-a-load-balancer/" topic: ["network"] --- # Connect a load balancer A load balancer gives your Auto Scaling Group one address and shares the requests among its VMs. [TIR Load Balancer](/tir/tir-load-balancer/) covers the load balancer itself. To make the same connection from the load balancer's side, see [Connect an Auto Scaling Group](/tir/tir-load-balancer/how-to/connect-an-auto-scaling-group/). ## Before you begin - An Auto Scaling Group in your project. See [Create an Auto Scaling Group](/tir/tir-auto-scaling/how-to/create-an-auto-scaling-group/). - A load balancer of the type Web traffic (HTTP/HTTPS) that is **Running** or **Stopped**. You can make one from the group; see [Make a load balancer for the group](#make-a-load-balancer-for-the-group). To make one separately, see [Create a Load Balancer](/tir/tir-load-balancer/how-to/create-a-load-balancer/). - Update permission on the Load Balancer service to attach and detach, and create permission to make a new load balancer. See [TIR Access Control](/tir/tir-iam/). - The port your application listens on. The VMs must answer on it. ## Make a load balancer for the group On the **Associated Load Balancers** tab of the group, select **Create Load Balancer**. The new load balancer starts with this group as its backend. ## Attach the group to a load balancer 1. On the details page of the group, open the **Associated Load Balancers** tab, which has every Web traffic load balancer the group can use. 2. Open the row menu of the load balancer and select **Attach**. 3. Under **Backend group**, check the **Name**, **Protocol** and **Port**. TIR suggests `-backend` as the name, adding -2, -3 and so on if the load balancer already uses it. Choose **HTTP**, **HTTPS**, or **gRPC**, and set **Port** to the port your application listens on. 4. Under **Routing rule**, check the **Rule name**, `-route` by default, and **When a request matches**. A rule with no condition sends every request to the group. 5. (Optional) Under **Advanced settings**, change how requests are distributed, the health check, the request timeout, and the number of retries. 6. Select **Attach**. If the load balancer already has a rule with no condition, this group would receive nothing, so add a condition to the new rule before you attach. Attaching creates a backend group and a routing rule. If the load balancer refuses the rule, the group is added but no traffic reaches it yet; detach, and attach again once the load balancer is healthy. ### Attach from the load balancer On the load balancer's own create or edit page, the backend picker lists an Auto Scaling Group under the tab **Auto Scaling Group**. You can pick a group only while it is **Running**. This attaches the group itself, not a snapshot of its VMs. An Auto Scaling Group needs a backend group of its own that holds only the group. ## Check which load balancers serve the group On **Associated Load Balancers**, **Traffic to this group** says whether requests reach the group. **Serving** means they do. Otherwise it says why not: the route is missing and the load balancer answers 503, the group has no VMs to serve, or the load balancer has failed, is stopped, is starting or is unavailable. **Domain** is the load balancer's address, once it has one. An attached load balancer stays listed even while it is **Initializing** or **Failed**. If there is none to attach, create one from the same tab. Once traffic reaches the group, **Connect** on **Overview** gives the load balancer's address as `https://`. ## Detach the group 1. On the **Associated Load Balancers** tab, open the row menu of the attached load balancer and select **Detach**. 2. Confirm. The group's VMs stop receiving traffic from the load balancer and keep running, and you can attach the group again at any time. Detaching also removes the backend group and its route when this group was its only member. If that was the load balancer's only routing rule, it then answers 503 to every request. ## Check that traffic reaches the group **Traffic to this group** reads **Serving** for the load balancer, and the **Domain** opens your application. Requests are shared among the VMs that the group has running. To see which VMs receive traffic, see [Monitor an Auto Scaling Group](/tir/tir-auto-scaling/how-to/monitor-an-auto-scaling-group/). For help with a group that returns 503, see [Troubleshooting TIR Auto Scaling Groups](/tir/tir-auto-scaling/troubleshooting/tir-auto-scaling/).