Create a Network Load Balancer
1 min
POST
https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers
Path Parameters
- datacenterIdstringrequiredDescription
Query Parameters
- prettybooleanDescriptionDefaulttrue
- depthinteger<int32>DescriptionDefault0Formatint32Minimum0Maximum10
Header Parameters
- X-Contract-Numberinteger<int32>DescriptionFormatint32
Body Parameters
- bodyNetworkLoadBalancerrequiredDescription
- typeobject
- Type
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesNetworkLoadBalancerPropertiesrequired
- namestringrequiredExampleDescription
- listenerLanintegerrequiredExampleDescription
- ipsstring[]Example
[ "81.173.1.2", "22.231.2.2", "22.231.2.3" ]
Description - targetLanintegerrequiredExampleDescription
- lbPrivateIpsstring[]Example
[ "81.173.1.5/24", "22.231.2.5/24" ]
Description - centralLoggingbooleanExampleDescription
- loggingFormatstringExampleDescription
- entitiesNetworkLoadBalancerEntities
- flowlogsFlowLogs
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsFlowLog[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesFlowLogPropertiesrequired
- namestringrequiredExampleDescription
- actionstring<ACCEPTED | REJECTED | ALL>requiredExampleDescriptionAllowedACCEPTEDREJECTEDALL
- directionstring<INGRESS | EGRESS | BIDIRECTIONAL>requiredExampleDescriptionAllowedINGRESSEGRESSBIDIRECTIONAL
- bucketstringrequiredExampleDescription
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
- forwardingrulesNetworkLoadBalancerForwardingRules
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsNetworkLoadBalancerForwardingRule[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesNetworkLoadBalancerForwardingRulePropertiesrequired
- namestringrequiredExampleDescription
- algorithmstring<ROUND_ROBIN | LEAST_CONNECTION | RANDOM | SOURCE_IP>requiredExampleDescriptionAllowedROUND_ROBINLEAST_CONNECTIONRANDOMSOURCE_IP
- protocolstring<HTTP | TCP>requiredExampleDescriptionAllowedHTTPTCP
- listenerIpstringrequiredExampleDescription
- listenerPortinteger<int32>requiredExampleDescriptionFormatint32
- healthCheckNetworkLoadBalancerForwardingRuleHealthCheck
- clientTimeoutinteger<int32>ExampleDescriptionFormatint32
- connectTimeoutinteger<int32>ExampleDescriptionFormatint32
- targetTimeoutinteger<int32>ExampleDescriptionFormatint32
- retriesinteger<int32>ExampleDescriptionFormatint32
- targetsNetworkLoadBalancerForwardingRuleTarget[]requiredDescription
- ipstringrequiredExampleDescription
- portinteger<int32>requiredExampleDescriptionFormatint32
- weightinteger<int32>requiredExampleDescriptionFormatint32
- proxyProtocolstring<none | v1 | v2 | v2ssl>ExampleDescriptionDefaultnoneAllowednonev1v2v2ssl
- healthCheckNetworkLoadBalancerForwardingRuleTargetHealthCheck
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
Responses
202
- NetworkLoadBalancer
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesNetworkLoadBalancerPropertiesrequired
- namestringrequiredExampleDescription
- listenerLanintegerrequiredExampleDescription
- ipsstring[]Example
[ "81.173.1.2", "22.231.2.2", "22.231.2.3" ]
Description - targetLanintegerrequiredExampleDescription
- lbPrivateIpsstring[]Example
[ "81.173.1.5/24", "22.231.2.5/24" ]
Description - centralLoggingbooleanExampleDescription
- loggingFormatstringExampleDescription
- entitiesNetworkLoadBalancerEntities
- flowlogsFlowLogs
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsFlowLog[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesFlowLogPropertiesrequired
- namestringrequiredExampleDescription
- actionstring<ACCEPTED | REJECTED | ALL>requiredExampleDescriptionAllowedACCEPTEDREJECTEDALL
- directionstring<INGRESS | EGRESS | BIDIRECTIONAL>requiredExampleDescriptionAllowedINGRESSEGRESSBIDIRECTIONAL
- bucketstringrequiredExampleDescription
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
- forwardingrulesNetworkLoadBalancerForwardingRules
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsNetworkLoadBalancerForwardingRule[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesNetworkLoadBalancerForwardingRulePropertiesrequired
- namestringrequiredExampleDescription
- algorithmstring<ROUND_ROBIN | LEAST_CONNECTION | RANDOM | SOURCE_IP>requiredExampleDescriptionAllowedROUND_ROBINLEAST_CONNECTIONRANDOMSOURCE_IP
- protocolstring<HTTP | TCP>requiredExampleDescriptionAllowedHTTPTCP
- listenerIpstringrequiredExampleDescription
- listenerPortinteger<int32>requiredExampleDescriptionFormatint32
- healthCheckNetworkLoadBalancerForwardingRuleHealthCheck
- clientTimeoutinteger<int32>ExampleDescriptionFormatint32
- connectTimeoutinteger<int32>ExampleDescriptionFormatint32
- targetTimeoutinteger<int32>ExampleDescriptionFormatint32
- retriesinteger<int32>ExampleDescriptionFormatint32
- targetsNetworkLoadBalancerForwardingRuleTarget[]requiredDescription
- ipstringrequiredExampleDescription
- portinteger<int32>requiredExampleDescriptionFormatint32
- weightinteger<int32>requiredExampleDescriptionFormatint32
- proxyProtocolstring<none | v1 | v2 | v2ssl>ExampleDescriptionDefaultnoneAllowednonev1v2v2ssl
- healthCheckNetworkLoadBalancerForwardingRuleTargetHealthCheck
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
Response Headers
- X-RateLimit-Remaininginteger<int32>DescriptionFormatint32
- X-RateLimit-Limitinteger<int32>DescriptionFormatint32
- X-RateLimit-Burstinteger<int32>DescriptionFormatint32
- LocationstringDescriptionPatternhttps://[apiBaseUri]/requests/[requestId]/status
default
- Error
- httpStatusinteger<int32>ExampleDescriptionFormatint32
- messagesErrorMessage[]
- errorCodestringExampleDescription
- messagestringExampleDescription
curl
curl --request POST \
--url 'https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers?pretty=true&depth=integer%3Cint32%3E' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"type": {},
"properties": {
"name": "My Network Load Balancer",
"listenerLan": 1,
"targetLan": 2
},
"entities": {
"flowlogs": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
]
},
"forwardingrules": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My Network Load Balancer forwarding rule",
"algorithm": "ROUND_ROBIN",
"protocol": "HTTP",
"listenerIp": "81.173.1.2",
"listenerPort": 8080,
"targets": [
{
"ip": "22.231.2.2",
"port": 8080,
"weight": 123,
"proxyProtocol": "none"
}
]
}
}
]
}
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"type": {},
"properties": {
"name": "My Network Load Balancer",
"listenerLan": 1,
"targetLan": 2
},
"entities": {
"flowlogs": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
]
},
"forwardingrules": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My Network Load Balancer forwarding rule",
"algorithm": "ROUND_ROBIN",
"protocol": "HTTP",
"listenerIp": "81.173.1.2",
"listenerPort": 8080,
"targets": [
{
"ip": "22.231.2.2",
"port": 8080,
"weight": 123,
"proxyProtocol": "none"
}
]
}
}
]
}
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers?pretty=true&depth=integer<int32>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers?pretty=true&depth=integer<int32>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"type": {},
"properties": {
"name": "My Network Load Balancer",
"listenerLan": 1,
"targetLan": 2
},
"entities": {
"flowlogs": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
]
},
"forwardingrules": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My Network Load Balancer forwarding rule",
"algorithm": "ROUND_ROBIN",
"protocol": "HTTP",
"listenerIp": "81.173.1.2",
"listenerPort": 8080,
"targets": [
{
"ip": "22.231.2.2",
"port": 8080,
"weight": 123,
"proxyProtocol": "none"
}
]
}
}
]
}
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers?pretty=true&depth=integer<int32>"
payload = json.dumps({
"type": {},
"properties": {
"name": "My Network Load Balancer",
"listenerLan": 1,
"targetLan": 2
},
"entities": {
"flowlogs": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
]
},
"forwardingrules": {
"type": {},
"items": [
{
"type": {},
"properties": {
"name": "My Network Load Balancer forwarding rule",
"algorithm": "ROUND_ROBIN",
"protocol": "HTTP",
"listenerIp": "81.173.1.2",
"listenerPort": 8080,
"targets": [
{
"ip": "22.231.2.2",
"port": 8080,
"weight": 123,
"proxyProtocol": "none"
}
]
}
}
]
}
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
202
// Successful operation
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My Network Load Balancer",
"listenerLan": 1,
"ips": [
""
],
"targetLan": 2,
"lbPrivateIps": [
""
],
"centralLogging": true,
"loggingFormat": "%{+Q}o %{-Q}ci - - [%trg] %r %ST %B \"\" \"\" %cp %ms %ft %b %s %TR %Tw %Tc %Tr %Ta %tsc %ac %fc %bc %sc %rc %sq %bq %CC %CS %hrl %hsl"
},
"entities": {
"flowlogs": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
],
"offset": 0,
"limit": 1000,
"_links": {
"prev": "<PREVIOUS-PAGE-URI>",
"self": "<THIS-PAGE-URI>",
"next": "<NEXT-PAGE-URI>"
}
},
"forwardingrules": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My Network Load Balancer forwarding rule",
"algorithm": "ROUND_ROBIN",
"protocol": "HTTP",
"listenerIp": "81.173.1.2",
"listenerPort": 8080,
"healthCheck": {
"clientTimeout": 50,
"connectTimeout": 5000,
"targetTimeout": 50000,
"retries": 3
},
"targets": [
{
"ip": "22.231.2.2",
"port": 8080,
"weight": 123,
"proxyProtocol": "v1",
"healthCheck": {
"": ""
}
}
]
}
}
],
"offset": 0,
"limit": 1000,
"_links": {
"prev": "<PREVIOUS-PAGE-URI>",
"self": "<THIS-PAGE-URI>",
"next": "<NEXT-PAGE-URI>"
}
}
}
}default
// Any erroneous status code: 400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported HTTP method), 415 (unsupported content type, 422 (validation error), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance).
{
"httpStatus": 400,
"messages": [
{
"errorCode": "123",
"message": "Error message example."
}
]
}Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.