Forwarding rules on a Vultr Load Balancer define how incoming traffic is directed to your backend servers. These rules allow you to specify a protocol, port, and target protocol/port for routing requests. By configuring forwarding rules, you can manage and optimize how traffic is distributed, enhancing the performance and accuracy of your load balancing setup.
Follow this guide to manage forwarding rules on a Vultr Load Balancer using the Vultr Customer Portal, API, or CLI.
Navigate to Products and click Load Balancers.
Click your target Load Balancer to open its management page.
Click Configuration.
Click Forwarding Rules in the left navigation menu.
Verify or modify the default forwarding rules.
Click Add another rule to set up a new forwarding rule.
Click the Protocol drop-down and select your target protocol from the list of options.
Enter the destination Load Balancer port and the target instance port in the respective Port fields.
Click Save changes to apply the forwarding rules.
Send a GET
request to the List Load Balancers endpoint and note the target Load Balancer's ID.
$ curl "https://api.vultr.com/v2/load-balancers" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Create Forwarding Rule endpoint to add new forwarding rules to the target Load Balancer.
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}/forwarding-rules" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"frontend_protocol": "{load-balancer-protocol}",
"frontend_port": {load-balancer-port},
"backend_protocol": "{instance-protocol}",
"backend_port": {instance-port}
}'
Send a GET
request to the List Forwarding Rules endpoint to view the forwarding rules of the target Load Balancer.
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}/forwarding-rules" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all available instances and note the target Vultr Load Balancer ID.
$ vultr-cli load-balancer list
Add new forwarding rules to the target Load Balancer.
$ vultr-cli load-balancer forwarding create <load-balancer-id> --frontend-protocol "<load-balancer-protocol>" --frontend-port <load-balancer-port> --backend-protocol "<instance-protocol>" --backend-port <instance-port>
List all forwarding rules for the target Load Balancer.
$ vultr-cli load-balancer forwarding list <load-balancer-id>
No comments yet.