Creating a Load Balancer

On Compute Cloud@Customer, you can create a load balancer (LB).

    1. In the Compute Cloud@Customer Console navigation menu, select Networking, then select Load Balancers.
    2. Select Create Load Balancer.
    3. Enter the following information:

      • Name: Enter a descriptive name for the LB. The name doesn't need to be unique, and you can change it. Avoid entering confidential information.

      • Create in Compartment: Select the compartment in which to create the LB. The LB doesn't have to be in the same compartment as the VCN or backend set. If you aren't sure which compartment to use, create the LB in the same compartment as the VCN.

      • Select Visibility Type:

        • Public Load Balancer. The Select Public IP menu is shown. Select a public IP from the list. You might need to change the compartment above the menu. If the menu displays None Available or if you do not select a public IP from the list, a public IP is automatically assigned from the configured public IP range. You can use the assigned public IP address as a front end for incoming traffic.

        • Private Load Balancer. The LB receives a private IP address from the selected subnet. You can use the assigned private IP address as a front end for internal incoming VCN traffic.

        See Load Balancers for more information about private and public load balancers.

      • Bandwidth: Select the shape type (either Flexible or Dynamic) and bandwidth for this LB. The bandwidth cannot be changed after the LB is created.

        • Flexible Shapes. Enter a minimum bandwidth and a maximum bandwidth in megabits per second (Mbps) in the fields below the type selection. To specify a fixed shape size, set the minimum and maximum bandwidth to the same value.

          The minimum bandwidth is the amount of bandwidth that is always available to provide instant readiness for the workloads.

          The maximum bandwidth is the greatest amount of bandwidth the LB supports during time of peak workload. The maximum bandwidth is set for all listeners such that all listeners share the given bandwidth inside the LB. The maximum bandwidth is a limit and is not guaranteed to be achieved. The maximum value that you can specify is 8000 Mbps.

        • Dynamic Shapes. Select the size from the menu below the type selection: Small (100 Mbps), Medium (400 Mbps), or Large (8000 Mbps).

          Note

          Oracle recommends using flexible shapes. Dynamic shapes are being deprecated.

      • Subnet: Select the names of the VCN and Subnet for the LB. You might need to change the compartment above the menus.

      • Network Security Group: (Optional) By default, the LB is not attached to any NSG. Select the box labeled Enable Network Security Group to add this LB to one or more NSGs.

        1. Select an NSG from the drop-down list. You might need to change the compartment to find the NSG that you want.

        2. Select Add Another NSG if you want to attach to another NSG.

        3. To remove an NSG from the list, select the trash can to the right of that NSG. To remove the last NSG or all NSGs, clear the Enable Network Security Groups box.

      • Tagging: (Optional) Add one or more tags to this resource. Tags can also be applied later. For more information about tagging resources, see Resource Tags.

    4. Select Create Load Balancer.

      The details LB details page is displayed.

    What's next?

    On the LB details page, under Resources, select resources to create to complete the configuration.

  • Use the oci lb load-balancer create command and required parameters to create a private load balancer.

    Procedure

    1. Gather the information that you need to run the command:

      • Compartment OCID: oci iam compartment list

      • At least one subnet OCID: oci network subnet list

    2. Run the create LB command.

      Syntax:

      The following examples show only the required parameters. Use the -h option to get information about optional parameters such as backend sets and listeners.

      oci lb load-balancer create --compartment-id compartment_OCID \
      --display-name load-balancer-name --shape-name 400Mbps \
      --subnet-ids file://subnet_OCIDs.json
      oci lb load-balancer create --compartment-id compartment_OCID \
      --display-name load-balancer-name \ 
      --shape-name [flexible | fixed-shape-name] \
      --subnet-ids file://subnet_OCIDs.json

      Example:

      The following example creates a private LB with a fixed bandwidth of 400 Mbps.

      The --is-private option value is false by default. If --is-private is omitted, a public IP address is assigned from one of the specified subnets if available. If --is-private true is specified, a private IP address is assigned from one of the specified subnets. See Load Balancers for more information about private and public load balancers.

      Specify "flexible" for --shape-name and then specify the minimum and maximum bandwidth in megabits per second (Mbps) in the value of the --shape-details option. The maximum value that you can specify is 8000 Mbps. To specify a fixed bandwidth, specify the same value for both minimum and maximum.

      --shape-details '{"maximumBandwidthInMbps": 400, "minimumBandwidthInMbps": 400}'

      The bandwidth can't be changed after the LB is created.

      Note

      We recommend specifying the "flexible" shape name and not a fixed bandwidth shape name such as 400Mbps. Dynamic shapes (fixed bandwidth shape names) are being deprecated.

      $ oci lb load-balancer create --compartment-id ocid1.compartment.unique_ID \
      --display-name Private_LB1 --shape-name 400Mbps \
      --subnet-ids '["ocid1.subnet.unique_ID1", "ocid1.subnet.unique_ID2"]'
      
      {
        "data": {
          "backend-sets": {},
          "certificates": {},
          "compartment-id": "ocid1.compartment.unique_ID",
          "defined-tags": {
            "Oracle-Tags": {
              "CreatedBy": "auser",
              "CreatedOn": "2025-01-28T23:12:58.28Z"
            },
          "display-name": "Private_LB1",
          "freeform-tags": null,
          "hostnames": {},
          "id": "ocid1.loadbalancer.unique_ID",
          "ip-addresses": [
            {
              "ip-address": "IP_address",
              "is-public": false,
              "reserved-ip": null
            }
          ],
          "is-private": true,
          "lifecycle-state": "ACTIVE",
          "listeners": {},
          "network-security-group-ids": null,
          "path-route-sets": {},
          "routing-policies": null,
          "rule-sets": {},
          "shape-details": null,
          "shape-name": "400Mbps",
          "ssl-cipher-suites": {},
          "subnet-ids": [
            "ocid1.subnet.unique_ID1",
            "ocid1.subnet.unique_ID2"
            ],
          "system-tags": null,
          "time-created": "2025-01-28T23:12:58.000001+00:00"
        },
      "etag": "00c648d7-b654-4583-b7bf-k5oed55"
      }
      $ oci lb load-balancer create --compartment-id ocid1.compartment.unique_ID \
      --display-name Private_LB1 --is-private true --shape-name flexible \
      --shape-details '{"maximumBandwidthInMbps": 400, "minimumBandwidthInMbps": 400}' \
      --subnet-ids '["ocid1.subnet.unique_ID1", "ocid1.subnet.unique_ID2"]'
      
      {
        "data": {
          "backend-sets": {},
          "certificates": {},
          "compartment-id": "ocid1.compartment.unique_ID",
          "defined-tags": {
            "Oracle-Tags": {
              "CreatedBy": "auser",
              "CreatedOn": "2025-01-28T23:12:58.28Z"
            },
          "display-name": "Private_LB1",
          "freeform-tags": null,
          "hostnames": {},
          "id": "ocid1.loadbalancer.unique_ID",
          "ip-addresses": [
            {
              "ip-address": "IP_address",
              "is-public": false,
              "reserved-ip": null
            }
          ],
          "is-private": true,
          "lifecycle-state": "ACTIVE",
          "listeners": {},
          "network-security-group-ids": null,
          "path-route-sets": {},
          "routing-policies": null,
          "rule-sets": {},
          "shape-details": {
            "maximumBandwidthInMbps": 400,
            "minimumBandwidthInMbps": 400
          },
          "shape-name": "flexible",
          "ssl-cipher-suites": {},
          "subnet-ids": [
            "ocid1.subnet.unique_ID1",
            "ocid1.subnet.unique_ID2"
            ],
          "system-tags": null,
          "time-created": "2025-01-28T23:12:58.000001+00:00"
        },
      "etag": "00c648d7-b654-4583-b7bf-k5oed55"
      }

      This output is the same as the output of the oci lb load-balancer get command.

      Next Steps: If you didn't create all the resources needed for the LB in the load-balancer create command, complete the LB configuration by adding resources using their separate commands, such as listener create. For a list of commands, use oci lb -h.

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

  • Use the CreateLoadBalancer operation to create a load balancer.

    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.