Create your first HTTP load balancer and origin
Create a load balancer and an upstream group, then add the origin that serves your application.
Before you start
You need an account-context API key with write access and a public origin hostname. Replace example.com with that origin hostname. Keep the returned resource identifiers for later requests.
Use https://<your-api-host> as your API base URL. The host is shown in the Balancer portal. Examples use $BALANCER_API_KEY for an existing credential with the required access.
Create the resources
- Create the HTTP load balancer:
curl --fail-with-body -sS -X POST "https://<your-api-host>/http-loadbalancers" \
-H "x-api-key: $BALANCER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"name":"first-site"}'
API reference: Creates a new HTTP load balancer
Expect HTTP 200 with data.httpLbId. Set HTTP_LB_ID to that returned identifier.
- Create the upstream group:
curl --fail-with-body -sS -X POST "https://<your-api-host>/upstream-groups" \
-H "x-api-key: $BALANCER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"name":"first-origin"}'
API reference: Creates a new upstream group (backend pool)
Expect HTTP 200 with data.upstreamGroupId. Set UPSTREAM_GROUP_ID to that returned identifier.
- Add the origin hostname:
curl --fail-with-body -sS -X POST "https://<your-api-host>/upstream-groups/$UPSTREAM_GROUP_ID/upstreams" \
-H "x-api-key: $BALANCER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"targetType":"domain","domain":"example.com"}'
API reference: Adds a backend target to an upstream group
Expect HTTP 200 with data.upstreamId. Provide either domain or address, never both.
- Read the upstreams to verify that your hostname was saved:
curl --fail-with-body -sS -X GET "https://<your-api-host>/upstream-groups/$UPSTREAM_GROUP_ID/upstreams" \
-H "x-api-key: $BALANCER_API_KEY"
API reference: List upstreams (backend servers) in an upstream group
Expect HTTP 200 and the upstream list. Verify the origin hostname, then create a group and route. Saving these resources does not establish that traffic is active at the edge.
| Setting | Default |
|---|---|
http2Enabled | true |
http3Enabled | false |
Upstream connectTimeoutMilliseconds | 5000 ms |
Upstream healthyPanicThreshold | 50 percent |
API reference
Need Help?
Contact your NetActuate account manager.