Routing Policy Management

Learn to use routing policies to apply a named ordered list of routing rules to a listener.

A routing policy is a named ordered list of routing rules that is applied to a listener.

Creating Routing Policies

Create a routing policy for a Load Balancer resource.

Use one of the following methods to create a routing policy for a selected load balancer.

To create a routing policy using the Console

Use the OCI Console to create a routing policy for a Load Balancer resource.

  1. Open the navigation menu, click Networking, and then click Load Balancers.

  2. Select the Compartment from the list.

    All load balancers and network load balancers in that compartment are listed in tabular form.

  3. (optional) Select a State from the list to limit the load balancers displayed to that state.

  4. (optional) Uncheck Load Balancer under Type to only display load balancers.

  5. Select the load balancer for which you want to create a routing policy.

    The Load Balancer Details dialog box appears.

  6. Click Routing Policies under Resources.

    The Routing Policy list appears. All routing policies are listed in tabular form.

  7. Click Create Routing Policy.

    The Create Routing Policy dialog box appears.

  8. Enter a Name for the routing policy rule set. A name is required. The name must be unique, and cannot be changed. The name cannot begin with a period and cannot 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.

  9. 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.

  10. 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.

  11. Click Next after you finish defining the rules.

    The next step is to confirm the order of the rules.

  12. In the right end of the order list row corresponding to that rule. Click the down arrow to see a summary of the conditions and actions set in a rule.

  13. 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.

  14. When the routing policy rules are created and in the right order, click Create Routing Policy.

To use a routing policy, you must create a listener that uses the policy.

To create a routing policy using the CLI

Use the command line interface (CLI) to create a routing policy for a Load Balancer resource.

Enter the following command:

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

See the CLI online help for a list of options:

oci lb routing-policy create --help

See oci lb routing-policy create for a complete description of the command.

To create a routing policy using the API

Use the API to create a routing policy for a Load Balancer resource.

Run the CreateRoutingPolicy method to get the details of a hostname for a load balancer. See CreateRoutingPolicy for a complete description.

Listing Routing Policies

List the routing policies for a Load Balancer resource.

Use one of the following methods to display a list of routing policies for a selected load balancer.

To list the routing policies using the Console

Use the OCI Console to list the routing policies for a Load Balancer resource.

  1. Open the navigation menu, click Networking, and then click Load Balancers.

  2. Select the Compartment from the list.

    All load balancers and network load balancers in that compartment are listed in tabular form.

  3. (optional) Select a State from the list to limit the load balancers displayed to that state.

  4. (optional) Uncheck Load Balancer under Type to only display load balancers.

  5. Select the load balancer for which you want to create a routing policy.

    The Load Balancer Details dialog box appears.

  6. Click Routing Policies under Resources.

    The Routing Policy list appears. All routing policies are listed in tabular form.

To list the routing policies using the CLI

Use the command line interface (CLI) to list the routing policies for a Load Balancer resource.

Enter the following command:

oci lb routing-policy list --load-balancer-id load_balancer_id [OPTIONS]

See the CLI online help for a list of options:

oci lb routing-policy list --help

See oci lb routing-policy list for a complete description of the command.

To list the routing policies using the API

Use the API to list the routing policies for a Load Balancer resource.

Run the ListRoutingPolicies method to display a list of hostnames for a load balancer. See ListRoutingPolicies for a complete description.

Getting Routing Policy Details

Get the details of a routing policy for a Load Balancer resource.

Use one of the following methods to display the details of a routing policy for a selected load balancer.

To get the details of a routing policy using the Console

Use the OCI Console to get the details of a routing policy for a Load Balancer resource.

  1. Open the navigation menu, click Networking, and then click Load Balancers.

  2. Select the Compartment from the list.

    All load balancers and network load balancers in that compartment are listed in tabular form.

  3. (optional) Select a State from the list to limit the load balancers displayed to that state.

  4. (optional) Uncheck Load Balancer under Type to only display load balancers.

  5. Select the load balancer for which you want to create a routing policy.

    The Load Balancer Details dialog box appears.

  6. Click Routing Policies under Resources.

    The Routing Policy list appears. All routing policies are listed in tabular form.

  7. Click the routing policy whose details you want to get.

    The Routing Policy Details page appears.

To get the details of a routing policy using the CLI

Use the command line interface (CLI) to get the details of a routing policy for a Load Balancer resource.

Enter the following command:

oci lb routing-policy get --routing-policy-name routing_policy_name --load-balancer-id load_balancer_id [OPTIONS]

See the CLI online help for a list of options:

oci lb routing-policy get --help

See oci lb routing-policy get for a complete description of the command.

To get the details of a routing policy using the API

Use the API to get the details of a routing policy for a Load Balancer resource.

Run the GetRoutingPolicy method to get the details of a hostname for a load balancer. See GetRoutingPolicy for a complete description.

Editing Routing Policy Details

Update a routing policy for a Load Balancer resource.

Use one of the following methods to edit and update the settings of a routing policy for a selected load balancer.

To edit a routing policy using the Console

Use the OCI Console to update a routing policy for a Load Balancer resource.

  1. Open the navigation menu, click Networking, and then click Load Balancers.

  2. Select the Compartment from the list.

    All load balancers and network load balancers in that compartment are listed in tabular form.

  3. (optional) Select a State from the list to limit the load balancers displayed to that state.

  4. (optional) Uncheck Load Balancer under Type to only display load balancers.

  5. Select the load balancer whose routing policy you want to edit.

    The Load Balancer Details dialog box appears.

  6. Click Routing Policies under Resources.

    The Routing Policy list appears. All routing policies are listed in tabular form.

  7. Click the routing policy whose settings you want to edit.

    The Routing Policy Details page appears.

  8. Click Edit.

    The Edit Routing Policy dialog box appears.

  9. Make your edits.

    See Creating Routing Policies for details on the routing policy settings.

  10. Click Save Changes.

To edit a routing policy using the CLI

Use the command line interface (CLI) to update a routing policy for a Load Balancer resource.

Enter the following command:

oci lb routing-policy update --routing-policy-name routing_policy_name --load-balancer-id load_balancer_id --rules rules [OPTIONS]

See the CLI online help for a list of options:

oci lb routing-policy update --help

See oci lb routing-policy update for a complete description of the command.

To edit a routing policy using the API

Use the API to update a routing policy for a Load Balancer resource.

Run the UpdateRoutingPolicy method to edit a routing policy for a load balancer. See UpdateRoutingPolicy for a complete description.

Deleting Routing Policies

Delete a routing policy from a Load Balancer resource.

Use one of the following methods to delete a routing policy from a selected load balancer.

To delete a routing policy using the Console

Use the OCI Console to delete a routing policy from a Load Balancer resource.

  1. Open the navigation menu, click Networking, and then click Load Balancers.

  2. Select the Compartment from the list.

    All load balancers and network load balancers in that compartment are listed in tabular form.

  3. (optional) Select a State from the list to limit the load balancers displayed to that state.

  4. (optional) Uncheck Load Balancer under Type to only display load balancers.

  5. Select the load balancer from which you want to delete a routing policy.

    The Load Balancer Details dialog box appears.

  6. Click Routing Policies under Resources.

    The Routing Policy list appears. All routing policies are listed in tabular form.

  7. Click the routing policy whose details you want to delete.

    The Routing Policy Details page appears.

  8. Click Delete.

  9. Confirm the deletion when prompted.

To delete a routing policy using the CLI

Use the command line interface (CLI) to delete a routing policy from a Load Balancer resource.

Enter the following command:

oci lb routing-policy delete --routing-policy-name routing_policy_name --load-balancer-id load_balancer_id [OPTIONS]

See the CLI online help for a list of options:

oci lb routing-policy delete --help

See oci lb routing-policy delete for a complete description of the command.

To delete a routing policy using the API

Use the API to delete a routing policy from a Load Balancer resource.

Run the DeleteRoutingPolicy method to delete a routing policy from a load balancer. See DeleteRoutingPolicy for a complete description.