CLI commands for NodeBalancers
Here are some common tasks to manage NodeBalancers using the Linode CLI.
List your NodeBalancers
Run this command to list all of the NodeBalancers on your account:
linode-cli linodes list
Create a new NodeBalancer
Run this command to create a new NodeBalancer:
linode-cli nodebalancers create --region us-east --label new-balancer
Target a specific NodeBalancer
Here are some common operations you can perform with a specific NodeBalancer.
Get the NodeBalancer's ID
You need a NodeBalancer's nodebalancer_id
to interact with it. You can get it by listing the NodeBalancers on your account, and then storing the target NodeBalancer's id
as your nodebalancer_id
for later use:
export linode_id=<id-string>
Create a configuration
With the nodebalancer_id
stored, run this command to create a new configuration on your NodeBalancer:
linode-cli nodebalancers config-create $nodebalancer_id
Attach a node
To add a new node to your NodeBalancer, follow these steps:
-
Have your
nodebalancer_id
stored. -
List the configurations on your NodeBalancer to get the
id
for the target one:linode-cli nodebalancers configs-list $node_balancer_id
-
Store the
id
as yourconfig_id
:export config_id=<id-string>
-
Run this command, replacing the
<ip_address>
variable with the address for the node:linode-cli nodebalancers node-create --address <ip_addpress> --label node-1 $nodebalancer_id $config_id
Delete a node
To delete an existing node, follow these steps:
-
Have your
nodebalancer_id
stored. -
List the configurations on your NodeBalancer to get the
id
for the target one:linode-cli nodebalancers configs-list $nodebalancer_id
-
Store the
id
as yourconfig_id
:export config_id=<id-string>
-
List the nodes in your NodeBalancer configuration to get the
id
for the target one:linode-cli nodebalancers nodes-list $nodebalancer_id $config_id
-
Store the
id
as yournode_id
:export node_id=<id-string>
-
Run this command to delete the node:
linode-cli nodebalancers node-delete $nodebalancer_id $config_id $node_id
There's more
Other actions are available. Use linode-cli nodebalancers --help
for a complete list.
Updated 8 days ago