fbpx

Routing Rules & Aliases

Routing Rules

Routing rules determine what ports the MLB will listen to and where to route the incoming requests.

In order to configure routing rules, follow these steps:

  1. In the MLB console, choose Balancers
  2. Choose a Load Balancer
  3. Go to Settings beneath the list of balancers
  4. In the Routing Rules Column press Edit

The Routing Rules menu includes the following options:

  1. Term – choose between: Path, Header, Host
  2. Configuration – write down the actual path / header you want to include
  3. RegEx – choose between:
    1. RegEx – This will accept the text as a regular expression
    2. Exact Match – This will accept the text exactly as it is
  4. Target Sets – Choose the target sets the MLB will route to
  5. Strategy – Choose between:
    1. Round Robin – The MLB will send the instances requests one after the other in a cyclical way
    2. Random – The MLB will send the instances requests randomly
    3. Least Connections – The MLB will send the request to the instance with the least active connections
    4. IP Hash – Takes the source and destination IP addresses and performs a mathematical calculation on each packet to determine which uplink in the team to use

Aliases

Aliases are used to enhance security in the MLB and make sure that only trusted requests by valid certificates go through. Aliases are also used to improve DNS Lookup performance. When an Alias is configured, it takes less time for the MLB to locate the Load Balancer based on the Alias DNS.

When creating an MLB, an A-record (DNS) is created in the following format: BALANCER-NAME.lb-UUID.lb1.spotinst.io

The MLB will then expect all traffic going through it to end with .spotinst.io. In order to receive traffic from an external source, an Alias is necessary.

The Alias is generated by creating a C-name in the users’ hosted zone.

The MLB will accept the top hierarchy of the C-name pointing at the A-record such that when adding test.com then api.test.com , help.test.com and other prefixes will be accepted by the MLB.

To configure an Alias, go to Route 53 and create a C-name pointing at the A-record. Then, configure the Alias in the MLB console

In order to configure the Alias, follow these steps:

  1. In the MLB console, choose Balancers
  2. Choose a Load Balancer
  3. Go to Settings beneath the list of balancers
  4. Add the Alias