Creating a Load Balancer Virtual Hostname

On Compute Cloud@Customer, a virtual hostname is associated with a load balancer (LB) and used by one or more listeners. Hostnames associated with a listener correspond to the backend set of that listener. The backend set routes traffic to specific backends which host different applications.

Virtual hostnames simplify the construction of the hostnames associated with listeners and backend servers because virtual hostnames can use wild card asterisks (*) at the start or end of the hostname. Listeners detect a hostname pattern that matches the virtual hostname patterns created.

Note

The asterisk (*) doesn't have to be used in a virtual hostname. However, when used, the asterisk can only be added at the beginning or ending of a virtual hostname. Traffic sent to app.example.com is load balanced by a listener and backend server set when configured as app.example.com (exact), *example.com (wild card at start), or app.example* (wild card at end).
    1. In the Compute Cloud@Customer Console navigation menu, select Networking, then select Load Balancers.

    2. At the top of the page, select the compartment that contains the load balancer.
    3. Select the name of the LB for which you want to create the virtual hostname.
    4. Under Resources, select Hostnames.
    5. Select Create Hostname.
    6. Enter the following information:

      • Name: A name for the LB virtual hostname.

      • Hostname: The virtual hostname.

    7. Select Create Hostname.

  • Use the oci lb hostname create command and required parameters to create a virtual hostname associated with a load balancer.

    1. Get the LB OCID: oci lb load-balancer list

    2. Run the create virtual hostname command.

      Syntax:

      oci lb hostname create --load-balancer-id load-balancer_OCID --hostname virtual-hostname --name virtual-hostname-friendly-name

      Example:

      $ oci lb hostname create --load-balancer-id ocid1.loadbalancer.unique_ID --hostname *example.com --name my_virtual_hostname
       
      {
        "opc-work-request-id": "ocid1.workrequest.oc1.pca.unique_ID"
      }

      To verify that the hostname was created, see Viewing a Load Balancer Virtual Hostname.

    For a complete list of CLI commands, flags, and options, see the Command Line Reference.

  • This task isn't available in the API.

    For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.