lb.targets.addAdd an instance or IP address as a target
Request syntax
POST /lb/api/load-balancers/{id}/targets
{
"type": "enum",
"instanceId": "string",
"ip": "string",
"usePrivateIp": "boolean",
"targetGroup": "string"
}Path parameters
idRequiredstring
Constraints: uuid
Request body
typeRequiredenum
`server` for a Deutsche Cloud instance, `ip` for an address
One of:
server,ipinstanceIdOptionalstring
Instance id (i-…). Required when type is server (400 without). The instance must be in your organization (400 "Instance not found") and in the load balancer’s region (400). application and public dedicated: it needs a public IPv4 (400); private dedicated: it must be in the load balancer’s VPC and have an address there (400)
Constraints: /^i-[0-9a-f]{6,32}$/
ipOptionalstring
IPv4 address. Required when type is ip (400 without). application and public dedicated: a public address that is not the platform’s own (400); private dedicated: inside the VPC’s CIDR (400)
usePrivateIpOptionalboolean
lb11/lb21/lb31, server targets: reach the instance over its private network address. Needs a load balancer created with vpcId (400). Refused (400) on application; ignored on dedicated, where the scheme decides (private: VPC address, public: public address). Default false
targetGroupOptionalstring
application load balancers: the target group this target serves (lower-case letters, digits and -, 1–32). Rules forward to a group; requests no rule matches go to `default`. Default `default`; any other value is refused (400) on the other types. At most 10 groups and 25 targets per application load balancer (400)
Constraints: /^[a-z0-9]([a-z0-9-]{0,30}[a-z0-9])?$/
Response
201 with the target: id, lbId, type, instanceId, ip, usePrivateIp, targetGroup, status (`unknown` on application until the fleet reports, `healthy` on the other types). application and dedicated pick it up within seconds; lb11/lb21/lb31 register it at the provider in the background. 409 for a server target an organization’s own-host fleet cannot reach. A load balancer another service owns (a Kubernetes Service, a database endpoint) is refused with 409: change it through its owner.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow lb:AddTarget on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud lb targets add id --type servercurl -X POST "https://console.platform-development.deutschecloud.app/lb/api/load-balancers/id/targets" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"server"}'Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_lb_targets_add.