Skip to content

Put a load balancer in front of a scale group

View as Markdown

Nodes in a scale group come and go as it scales, each with its own addresses. An Application Load Balancer (ALB) in front of the scale group gives your users one address for all of them.

You attach the scale group to an ALB by choosing Auto Scale Group as its backend type. Scale groups work with ALBs only, so use an ALB rather than a Network Load Balancer (NLB). The ALB sends traffic to each node at its private IP on the port you set. E2E adds each node to the load balancer when it starts running, and takes it off when it is removed.

The load balancer is billed on its own, and keeps its charges while the scale group is stopped; see E2E’s pricing page.

  • You have a scale group. See Create a scale group.
  • You know the port your application listens on in the scale group nodes, and whether it speaks HTTP or HTTPS there.
  • Your application answers an HTTP HEAD / request on that port with a success status, such as 200 OK. Health Check is on by default when you create the load balancer. It checks each node this way and skips any node that fails the check.
  • One of the scale group’s security groups allows inbound traffic on that port from the load balancer’s private IP. See Manage a scale group’s network and security groups.
  • For HTTPS or Both (HTTP and HTTPS), you have an SSL certificate in MyAccount, or you are ready to import one.

To check that a node answers the health check, sign in to one of the nodes; see Sign in to scale group nodes. Then run this, where <scaler-port> is your application’s port:

curl -I http://localhost:<scaler-port>/

Or run it from another machine in the same network as the scale group, with a node’s Private IP from Active Node Details in place of <private-ip>:

curl -I http://<private-ip>:<scaler-port>/

The first line of the answer shows the status. A success status, such as 200, means the node will pass the check:

HTTP/1.1 200 OK

Create the load balancer with the scale group as its backend

Section titled “Create the load balancer with the scale group as its backend”
  1. In MyAccount, under Compute, click Load Balancers, and click Create New Load Balancer.
  2. Pick a plan, and choose Application Load Balancer (ALB).
  3. On Details, fill in:
    • Name is filled in for you. Keep it, or enter your own, using letters, digits, underscores, and hyphens.
    • Scheme: choose External (with public IP) - Distributes traffic from external sources, the default, for users on the internet, or Internal (without public IP) - Distributes traffic within private VPC networks for traffic from inside your VPCs.
    • Frontend Protocol: how users reach the load balancer. With HTTP, the load balancer listens on port 80. With HTTPS or Both (HTTP and HTTPS), the default, its LB Listening Port is 443, shown on its Info tab.
    • For HTTPS or Both (HTTP and HTTPS), under SSL, choose a certificate, or follow the link under it to import one. (Optional) Select HTTP Redirect.
  4. On Target Mapping, set Backend Type to Auto Scale Group.
  5. Under Auto Scaling Group, choose your scale group. The list shows only the five most recently created scale groups in the project. If yours is missing, see The scale group is not offered on the load balancer.
  6. Enter the Scaler Port, the port your application listens on in each node, from 1 to 65535. It is separate from the port the load balancer listens on, so the two can differ. The load balancer sends traffic to each node’s private IP on this port.
  7. Set Backend Protocol to HTTP or HTTPS, the protocol your application speaks on the Scaler Port.
  8. On Summary, click Launch Load Balancer. MyAccount creates the load balancer and returns you to the load balancer list.

Once an external load balancer is running, find its public IP in the Public IP column of the load balancer list, or as Public IP on its Info tab. Open its address in a browser, where <load-balancer-ip> is that IP. For HTTP:

http://<load-balancer-ip>/

For HTTPS or Both (HTTP and HTTPS), first point your domain’s DNS record at the load balancer’s Public IP, then open this address, where <your-domain> is the domain on the certificate you chose under SSL:

https://<your-domain>/

An Internal load balancer has no public IP, so test it from a machine in the same VPC.

You will see your application, served by one of the nodes. If you see an error or nothing loads, see 503 Service Unavailable.

Point an existing load balancer at another scale group

Section titled “Point an existing load balancer at another scale group”

To roll out a new version of your application, move the load balancer to a new scale group. Save a new image from a node that runs it, create a new scale group from that image, and point the load balancer at the new scale group.

You can edit the backends once the load balancer has finished creating or deploying, and only while it is powered on. While it is powered off, you see:

You can't edit Load Balancer in 'Powered off' state.
  1. Wait until the new scale group reads Running. See Create a scale group.
  2. In MyAccount, under Compute, click Load Balancers, open the load balancer, and open its Backend Mapping tab.
  3. Edit the backend group’s row, or click Add Backend Group for a new one.
  4. Set Backend Type to Auto Scale Group, choose the new scale group under Auto Scaling Group, and enter the Scaler Port.
  5. Click Save and Deploy, and confirm in Update Backend.

The change takes about five to 10 minutes. After that, the new scale group’s Attached LB tab lists the load balancer, and the old scale group’s tab no longer does. Then you can delete the old scale group; see Delete a scale group.

Check which load balancers use the scale group

Section titled “Check which load balancers use the scale group”

In MyAccount, under Compute, click Auto Scaling, click your scale group, and open its Attached LB tab. While the scale group reads Running or Scaling, the tab lists every load balancer that uses the scale group, with its LB Name and Status. If no load balancer uses the scale group, it says Currently no Attached Load Balancer available.

Your users now reach the scale group through the load balancer’s address. If your scale group is missing from Auto Scaling Group, see Troubleshooting Auto Scaling.