Question: How to Configure Network Settings for Vultr Load Balancer
A secure, isolated virtual network for connecting and managing your Vultr resources with private communication.
Configuring Network Settings for your Vultr Load Balancer involves associating it with a specific Virtual Private Cloud (VPC) network. This allows the Load Balancer to operate within the specified network, ensuring it interacts correctly with other resources and adheres to network policies.
Follow this guide to configure network settings for your Vultr Load Balancer using the Vultr Customer Portal, API, CLI, or Terraform.
Vultr Customer Portal
Non‑Public VPC can be selected at creation time and, for Global Load Balancers, per region after creation.
Create time
1.Navigate to Products and click Load Balancers.
2.Click Create Load Balancer.
3.In Load Balancer Configuration, click Non‑Public VPC Network and select your VPC.
4.Complete the remaining settings and click Create Load Balancer.
Per‑region (Global Load Balancer)
1.Open the parent Load Balancer.
2.In the Location table, use the Network column on a region row to select the VPC for that child Load Balancer, then save.
Vultr API
1.Send a GET request to the List Load Balancers endpoint to find your Load Balancer ID.
console
curl "https://api.vultr.com/v2/load-balancers" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
2.Identify the target Load Balancer and VPC ID from the response.
3.Send a PATCH request to the Update Load Balancer endpoint to assign a VPC network.
[color=blue]console
[/color]
curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"vpc": "vpc-id-goes-here"
}'
Vultr CLI
1.List all available Load Balancers and note the ID of your target Load Balancer.
[color=blue]console[/color]
vultr-cli load-balancer list
2.Update the Load Balancer to assign it to a VPC.
[color=blue]console[/color]
vultr-cli load-balancer update <load-balancer-id> --vpc <vpc-id>
Terraform
1.Open your Terraform configuration file for the existing Load Balancer and VPC.
2.Add the vpc_id field to associate the Load Balancer with your target VPC.
[color=blue]terraform[/color]
resource "vultr_vpc" "private_net" {
region = "ewr"
description = "private-network"
}
resource "vultr_load_balancer" "lb" {
region = "ewr"
label = "vultr-load-balancer"
balancing_algorithm = "roundrobin"
vpc = vultr_vpc.private_net.id
}
3.Apply the configuration and observe the following output:
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.