0

Update a NodeBalancer

by
Published Oct 17, 2025

Updates information about a NodeBalancer you can access. > --- - __CLI__. ``` linode-cli nodebalancers update 12345 \ --label balancer12345 \ --client_conn_throttle 0 ``` [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli) - __OAuth scopes__. ``` nodebalancers:read_write ``` [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update a NodeBalancer
7
 * Updates information about a NodeBalancer you can access.
8

9

10
>
11

12
---
13

14

15
- __CLI__.
16

17
    ```
18
    linode-cli nodebalancers update 12345 \
19
  --label balancer12345 \
20
  --client_conn_throttle 0
21
    ```
22

23
    [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli)
24

25
- __OAuth scopes__.
26

27
    ```
28
    nodebalancers:read_write
29
    ```
30

31
    [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)
32
 */
33
export async function main(
34
  auth: Linode,
35
  apiVersion: "v4" | "v4beta",
36
  nodeBalancerId: string,
37
  body: {
38
    client_conn_throttle?: number;
39
    created?: string;
40
    hostname?: string;
41
    id?: number;
42
    ipv4?: string;
43
    ipv6?: string;
44
    label?: string;
45
    lke_cluster?: { id?: string; label?: string; type?: string; url?: string };
46
    region?: string;
47
    tags?: string[];
48
    transfer?: { in?: number; out?: number; total?: number };
49
    type?: "common";
50
    updated?: string;
51
  },
52
) {
53
  const url = new URL(
54
    `https://api.linode.com/${apiVersion}/nodebalancers/${nodeBalancerId}`,
55
  );
56

57
  const response = await fetch(url, {
58
    method: "PUT",
59
    headers: {
60
      "Content-Type": "application/json",
61
      Authorization: "Bearer " + auth.token,
62
    },
63
    body: JSON.stringify(body),
64
  });
65
  if (!response.ok) {
66
    const text = await response.text();
67
    throw new Error(`${response.status} ${text}`);
68
  }
69
  return await response.json();
70
}
71