Skip to content

Create an NLB via API

This page describes how to create a STACKIT Network Load Balancer using the API after you meet the requirements.

To create a STACKIT Network Load Balancer, send a POST request to the API endpoint with a valid Bearer token for authentication, your project ID, and the required configuration details.

Refer to the STACKIT API documentation for detailed parameter descriptions.

API endpoints:

https://load-balancer.api.eu01.stackit.cloud/v1/projects/{projectId}/load-balancers
https://lb-application-qa.api.eu01.qa.stackit.cloud/v1beta/projects/{projectId}/load-balancers/{name}

The following example shows how to create a STACKIT Network Load Balancer with session persistence based on the source IP address. Enabling session persistence changes the load balancing algorithm from Round Robin to Maglev.

{
"disableTargetSecurityGroupAssignment": false,
"externalAddress": "45.xxx.xxx.xxx",
"listeners": [
{
"displayName": "demo",
"port": 80,
"protocol": "PROTOCOL_TCP",
"targetPool": "demo-pool"
}
],
"name": "demo-lb",
"networks": [
{
"networkId": "a8815d0c-874b-4e47-xxxx-xxxxxxxxxxx",
"role": "ROLE_LISTENERS_AND_TARGETS"
}
],
"targetPools": [
{
"name": "demo-pool",
"targetPort": 80,
"sessionPersistence": {
"useSourceIpAddress": true
},
"targets": [
{
"displayName": "webserver01",
"ip": "193.xxx.xxx.xxx"
},
{
"displayName": "webserver02",
"ip": "45.xxx.xxx.xxx"
}
]
}
]
}