Skip to content
  • Auto
  • Light
  • Dark

Update

Update a Load Balancer
put/v2/load_balancers/{lb_id}

To update a load balancer's settings, send a PUT request to /v2/load_balancers/$LOAD_BALANCER_ID. The request should contain a full representation of the load balancer including existing attributes. It may contain one of the droplets_ids or tag attributes as they are mutually exclusive. Note that any attribute that is not provided will be reset to its default value.

Path Parameters
lb_idstring
minimum1
Body Parameters
bodyunion
One of the following 2 object variants:
Hide ParametersShow Parameters
AssignDropletsByIDobject
Hide ParametersShow Parameters
forwarding_rulesarray of entry_portnumberentry_protocolenumtarget_portnumbertarget_protocolenumcertificate_idstringtls_passthroughbooleanForwardingRule

An array of objects specifying the forwarding rules for a load balancer.

idstring
optional

A unique ID that can be used to identify and reference a load balancer.

formatuuid
algorithmenum
optional
deprecated
"round_robin" OR "least_connections"

This field has been deprecated. You can no longer specify an algorithm for load balancers.

Hide ParametersShow Parameters
"round_robin"
"least_connections"
created_atstring
optional

A time value given in ISO8601 combined date and time format that represents when the load balancer was created.

formatdate-time
disable_lets_encrypt_dns_recordsboolean
optional

A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.

domainsarray of certificate_idstringis_managedbooleannamestringDomains
optional

An array of objects specifying the domain configurations for a Global load balancer.

droplet_idsarray of number
optional

An array containing the IDs of the Droplets assigned to the load balancer.

enable_backend_keepaliveboolean
optional

A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.

enable_proxy_protocolboolean
optional

A boolean value indicating whether PROXY Protocol is in use.

firewallallowarray of stringdenyarray of stringLbFirewall
optional

An object specifying allow and deny rules to control traffic to the load balancer.

glb_settingscdnobjectfailover_thresholdnumberregion_prioritiesmaptarget_portnumbertarget_protocolenumGlbSettings
optional

An object specifying forwarding configurations for a Global load balancer.

health_checkcheck_interval_secondsnumberhealthy_thresholdnumberpathstringportnumberprotocolenumresponse_timeout_secondsnumberunhealthy_thresholdnumberHealthCheck
optional

An object specifying health check settings for the load balancer.

http_idle_timeout_secondsnumber
optional

An integer value which configures the idle timeout for HTTP requests to the target droplets.

minimum30
maximum600
ipstring
optional

An attribute containing the public-facing IP address of the load balancer.

ipv6string
optional

An attribute containing the public-facing IPv6 address of the load balancer.

namestring
optional

A human-readable name for a load balancer instance.

networkenum
optional
"EXTERNAL" OR "INTERNAL"

A string indicating whether the load balancer should be external or internal. Internal load balancers have no public IPs and are only accessible to resources on the same VPC network. This property cannot be updated after creating the load balancer.

Hide ParametersShow Parameters
"EXTERNAL"
"INTERNAL"
network_stackenum
optional
"IPV4" OR "DUALSTACK"

A string indicating whether the load balancer will support IPv4 or both IPv4 and IPv6 networking. This property cannot be updated after creating the load balancer.

Hide ParametersShow Parameters
"IPV4"
"DUALSTACK"
project_idstring
optional

The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created.

redirect_http_to_httpsboolean
optional

A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.

regionenum
optional
"ams1" OR "ams2" OR "ams3" OR 12 more

The slug identifier for the region where the resource will initially be available.

Hide ParametersShow Parameters
"ams1"
"ams2"
"ams3"
"blr1"
"fra1"
"lon1"
"nyc1"
"nyc2"
"nyc3"
"sfo1"
"sfo2"
"sfo3"
"sgp1"
"tor1"
"syd1"
sizeenum
optional
deprecated
"lb-small" OR "lb-medium" OR "lb-large"

This field has been replaced by the size_unit field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes.

  • lb-small = 1 node
  • lb-medium = 3 nodes
  • lb-large = 6 nodes

You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation.

Hide ParametersShow Parameters
"lb-small"
"lb-medium"
"lb-large"
size_unitnumber
optional

How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.

minimum1
maximum100
statusenum
optional
"new" OR "active" OR "errored"

A status string indicating the current state of the load balancer. This can be new, active, or errored.

Hide ParametersShow Parameters
"new"
"active"
"errored"
sticky_sessionscookie_namestringcookie_ttl_secondsnumbertypeenumStickySessions
optional

An object specifying sticky sessions settings for the load balancer.

target_load_balancer_idsarray of string
optional

An array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.

tls_cipher_policyenum
optional
"DEFAULT" OR "STRONG"

A string indicating the policy for the TLS cipher suites used by the load balancer. The possible values are DEFAULT or STRONG. The default value is DEFAULT.

Hide ParametersShow Parameters
"DEFAULT"
"STRONG"
typeenum
optional
"REGIONAL" OR "REGIONAL_NETWORK" OR "GLOBAL"

A string indicating whether the load balancer should be a standard regional HTTP load balancer, a regional network load balancer that routes traffic at the TCP/UDP transport layer, or a global load balancer.

Hide ParametersShow Parameters
"REGIONAL"
"REGIONAL_NETWORK"
"GLOBAL"
vpc_uuidstring
optional

A string specifying the UUID of the VPC to which the load balancer is assigned.

formatuuid
AssignDropletsByTagobject
Hide ParametersShow Parameters
forwarding_rulesarray of entry_portnumberentry_protocolenumtarget_portnumbertarget_protocolenumcertificate_idstringtls_passthroughbooleanForwardingRule

An array of objects specifying the forwarding rules for a load balancer.

idstring
optional

A unique ID that can be used to identify and reference a load balancer.

formatuuid
algorithmenum
optional
deprecated
"round_robin" OR "least_connections"

This field has been deprecated. You can no longer specify an algorithm for load balancers.

Hide ParametersShow Parameters
"round_robin"
"least_connections"
created_atstring
optional

A time value given in ISO8601 combined date and time format that represents when the load balancer was created.

formatdate-time
disable_lets_encrypt_dns_recordsboolean
optional

A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.

domainsarray of certificate_idstringis_managedbooleannamestringDomains
optional

An array of objects specifying the domain configurations for a Global load balancer.

enable_backend_keepaliveboolean
optional

A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.

enable_proxy_protocolboolean
optional

A boolean value indicating whether PROXY Protocol is in use.

firewallallowarray of stringdenyarray of stringLbFirewall
optional

An object specifying allow and deny rules to control traffic to the load balancer.

glb_settingscdnobjectfailover_thresholdnumberregion_prioritiesmaptarget_portnumbertarget_protocolenumGlbSettings
optional

An object specifying forwarding configurations for a Global load balancer.

health_checkcheck_interval_secondsnumberhealthy_thresholdnumberpathstringportnumberprotocolenumresponse_timeout_secondsnumberunhealthy_thresholdnumberHealthCheck
optional

An object specifying health check settings for the load balancer.

http_idle_timeout_secondsnumber
optional

An integer value which configures the idle timeout for HTTP requests to the target droplets.

minimum30
maximum600
ipstring
optional

An attribute containing the public-facing IP address of the load balancer.

ipv6string
optional

An attribute containing the public-facing IPv6 address of the load balancer.

namestring
optional

A human-readable name for a load balancer instance.

networkenum
optional
"EXTERNAL" OR "INTERNAL"

A string indicating whether the load balancer should be external or internal. Internal load balancers have no public IPs and are only accessible to resources on the same VPC network. This property cannot be updated after creating the load balancer.

Hide ParametersShow Parameters
"EXTERNAL"
"INTERNAL"
network_stackenum
optional
"IPV4" OR "DUALSTACK"

A string indicating whether the load balancer will support IPv4 or both IPv4 and IPv6 networking. This property cannot be updated after creating the load balancer.

Hide ParametersShow Parameters
"IPV4"
"DUALSTACK"
project_idstring
optional

The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created.

redirect_http_to_httpsboolean
optional

A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.

regionenum
optional
"ams1" OR "ams2" OR "ams3" OR 12 more

The slug identifier for the region where the resource will initially be available.

Hide ParametersShow Parameters
"ams1"
"ams2"
"ams3"
"blr1"
"fra1"
"lon1"
"nyc1"
"nyc2"
"nyc3"
"sfo1"
"sfo2"
"sfo3"
"sgp1"
"tor1"
"syd1"
sizeenum
optional
deprecated
"lb-small" OR "lb-medium" OR "lb-large"

This field has been replaced by the size_unit field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes.

  • lb-small = 1 node
  • lb-medium = 3 nodes
  • lb-large = 6 nodes

You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation.

Hide ParametersShow Parameters
"lb-small"
"lb-medium"
"lb-large"
size_unitnumber
optional

How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.

minimum1
maximum100
statusenum
optional
"new" OR "active" OR "errored"

A status string indicating the current state of the load balancer. This can be new, active, or errored.

Hide ParametersShow Parameters
"new"
"active"
"errored"
sticky_sessionscookie_namestringcookie_ttl_secondsnumbertypeenumStickySessions
optional

An object specifying sticky sessions settings for the load balancer.

tagstring
optional

The name of a Droplet tag corresponding to Droplets assigned to the load balancer.

target_load_balancer_idsarray of string
optional

An array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.

tls_cipher_policyenum
optional
"DEFAULT" OR "STRONG"

A string indicating the policy for the TLS cipher suites used by the load balancer. The possible values are DEFAULT or STRONG. The default value is DEFAULT.

Hide ParametersShow Parameters
"DEFAULT"
"STRONG"
typeenum
optional
"REGIONAL" OR "REGIONAL_NETWORK" OR "GLOBAL"

A string indicating whether the load balancer should be a standard regional HTTP load balancer, a regional network load balancer that routes traffic at the TCP/UDP transport layer, or a global load balancer.

Hide ParametersShow Parameters
"REGIONAL"
"REGIONAL_NETWORK"
"GLOBAL"
vpc_uuidstring
optional

A string specifying the UUID of the VPC to which the load balancer is assigned.

formatuuid
Returns
load_balancerforwarding_rulesarray of ForwardingRuleidstringalgorithmenumcreated_atstringdisable_lets_encrypt_dns_recordsbooleandomainsarray of Domainsdroplet_idsarray of numberenable_backend_keepalivebooleanenable_proxy_protocolbooleanfirewallLbFirewallglb_settingsGlbSettingshealth_checkHealthCheckhttp_idle_timeout_secondsnumberipstringipv6stringnamestringnetworkenumnetwork_stackenumproject_idstringredirect_http_to_httpsbooleanregionRegionsizeenumsize_unitnumberstatusenumsticky_sessionsStickySessionstagstringtarget_load_balancer_idsarray of stringtls_cipher_policyenumtypeenumvpc_uuidstringLoadBalancer
optional
curl https://api.digitalocean.com//v2/load_balancers/$LB_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $GRADIENTAI_API_KEY" \
    -d '{
      "forwarding_rules": [
        {
          "entry_port": 443,
          "entry_protocol": "https",
          "target_port": 80,
          "target_protocol": "http"
        }
      ],
      "algorithm": "round_robin",
      "disable_lets_encrypt_dns_records": true,
      "droplet_ids": [
        3164444,
        3164445
      ],
      "enable_backend_keepalive": true,
      "enable_proxy_protocol": true,
      "http_idle_timeout_seconds": 90,
      "name": "example-lb-01",
      "network": "EXTERNAL",
      "network_stack": "IPV4",
      "project_id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
      "redirect_http_to_https": true,
      "region": "nyc3",
      "size": "lb-small",
      "size_unit": 3,
      "target_load_balancer_ids": [
        "7dbf91fe-cbdb-48dc-8290-c3a181554905",
        "996fa239-fac3-42a2-b9a1-9fa822268b7a"
      ],
      "tls_cipher_policy": "STRONG",
      "type": "REGIONAL",
      "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b"
    }'
200 Example
{
  "load_balancer": {
    "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
    "name": "updated-example-lb-01",
    "ip": "104.131.186.241",
    "size": "lb-small",
    "algorithm": "round_robin",
    "status": "new",
    "created_at": "2017-02-01T22:22:58Z",
    "forwarding_rules": [
      {
        "entry_protocol": "http",
        "entry_port": 80,
        "target_protocol": "http",
        "target_port": 80,
        "certificate_id": "",
        "tls_passthrough": false
      },
      {
        "entry_protocol": "https",
        "entry_port": 443,
        "target_protocol": "https",
        "target_port": 443,
        "certificate_id": "",
        "tls_passthrough": true
      }
    ],
    "health_check": {
      "protocol": "http",
      "port": 80,
      "path": "/",
      "check_interval_seconds": 10,
      "response_timeout_seconds": 5,
      "healthy_threshold": 5,
      "unhealthy_threshold": 3
    },
    "sticky_sessions": {
      "type": "none"
    },
    "region": {
      "name": "New York 3",
      "slug": "nyc3",
      "sizes": [
        "s-1vcpu-1gb",
        "s-1vcpu-2gb",
        "s-1vcpu-3gb",
        "s-2vcpu-2gb",
        "s-3vcpu-1gb",
        "s-2vcpu-4gb",
        "s-4vcpu-8gb",
        "s-6vcpu-16gb",
        "s-8vcpu-32gb",
        "s-12vcpu-48gb",
        "s-16vcpu-64gb",
        "s-20vcpu-96gb",
        "s-24vcpu-128gb",
        "s-32vcpu-192gb"
      ],
      "features": [
        "private_networking",
        "backups",
        "ipv6",
        "metadata",
        "install_agent"
      ],
      "available": true
    },
    "tag": "",
    "droplet_ids": [
      3164444,
      3164445
    ],
    "redirect_http_to_https": false,
    "enable_proxy_protocol": true,
    "enable_backend_keepalive": true,
    "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
    "disable_lets_encrypt_dns_records": false,
    "project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
    "http_idle_timeout_seconds": 60,
    "firewall": {
      "deny": [
        "cidr:1.2.0.0/16",
        "ip:2.3.4.5"
      ],
      "allow": [
        "ip:1.2.3.4",
        "cidr:2.3.4.0/24"
      ]
    }
  }
}