Creating a Load Balancer Routing Policy

Create a routing policy to guide a load balancer's routing behavior.

For prerequisite information, see Routing Policies for Load Balancers.

Note

To use a routing policy, you must create a listener that uses the policy. See Creating a Listener for more information.

    1. Open the navigation menu, click Networking, and then click Load balancers. Click Load balancer. The Load balancers page appears.
    2. Select the Compartment from the list. All load balancers in that compartment are listed in tabular form.
    3. Select a State from the list to limit the load balancers displayed to that state.
    4. Select the load balancer for which you want to create a routing policy. The load balancer's Details page appears.
    5. Click Routing policies under Resources. The Routing policy list appears. All routing policies are listed in tabular form.
    6. Click Create routing policy. The Create routing policy dialog box appears.
    7. Enter a Name for the routing policy rule set. A name is required. The name must be unique, and cannot be changed. The name can't begin with a period and can't contain any of these characters: ; ? # / % \ ] [. The name must start with an lower- or upper- case letter or an underscore, and the rest of the name can contain numbers, underscores, and upper- or lower-case letters.
    8. To create a rule in the rule set:
      1. Choose If all match (peer conditions use a logical AND) or If any match (peer conditions use a logical OR). In rules with multiple conditions, this selection guides whether one or all stated conditions produce an action. There can be up to five rule conditions, and you can have up to five nested conditions within a top-level condition. There can be up to 200 conditions total in a policy. Nested conditions can't have further conditions nested within them.

      2. Each top-level condition has a type, a match style, and a final criteria.

        • Condition type: The setting can be Path, Request cookies, Request header, URL query, or Nested match. The available fields for a condition change depending on the condition type.

          A Nested match also has a Nested conditions match criteria for conditions nested within, allowing you to have a mix of AND and OR in a condition. Click +Another nested condition to add another nested condition within the group. You can only nest conditions one level deep.

        • The match style for Path can be: Is, Is not, Starts with, Does not start with, Ends with, or Does not end with.

          The match style for Request header, Request cookies, and URL Query can be: Contains, Does not contain, Exists, or Does not exist.

        • The final criteria depends on the Condition type selected, and can be a URL string (All Path conditions use this) a Key:Value pair or simply a Key.

      3. Select the Action. If you choose Route to backend set, select the destination backend set from the list of available sets.

      4. To create another rule, click + Another rule.

      You can also click Show advanced controls. An editing window opens where you can directly enter text to define rules using the Routing Policy Language for Load Balancers.
    9. Click Next after you finish defining the rules. The next step is to confirm the order of the rules.
    10. Click next to the rule to display a summary of the conditions and actions set in a rule.
    11. Click Reorder to move a rule up or down in the policy order. Choose from among Move to top, Move to bottom, Move up, or Move down. The last two options shift that rule up or down by one position in the order.
    12. When the routing policy rules are created and in the correct order, click Create routing policy.
  • Use the oci lb routing-policy create command and required parameters to create a routing policy for a load balancer:

    oci lb routing-policy create --name name --load-balancer-id load_balancer_id --condition-language-version condition_language_version --rules rules [OPTIONS]

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the CreateRoutingPolicy operation to create a routing policy for a load balancer.