Configuring Firewall Rules for Vultr Load Balancer allows you to control the traffic that can reach your load-balanced applications. By setting up firewall rules, you can specify which IP addresses and ports are allowed or blocked, enhancing the security of your services. This feature helps protect your backend servers from unauthorized access and potential threats by filtering incoming traffic based on your defined criteria.
Follow this guide to configure firewall rules for your Vultr Load Balancer using the Vultr Customer Portal, API, or CLI.
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 PATCH
request to the Update Load Balancer endpoint to add a firewall rule to the target Load Balancer's algorithm.
$ 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 '{
"firewall_rules": [
{
"port" : {allowed_port_number},
"ip_type" : "{v4_or_v6}",
"source" : "{source_ip_cidr}"
}
]
}'
Send a GET
request to the List Firewall Rules endpoint to view all firewall rules set for the target Load Balancer.
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}/firewall-rules" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all available instances and note the target Load Balancer's ID.
$ vultr-cli load-balancer list
Add firewall rule to the target Load Balancer.
$ vultr-cli load-balancer update <loadbalancer-id> --firewall-rules "port:<allowed_port_number>,ip_type:<v4_or_v6>,source:<source_ip_cidr>"
View all firewall rules set for the target Load Balancer.
$ vultr-cli load-balancer firewall list <load-balancer-id>
No comments yet.