fbpx
PUThttps://api.spotinst.io/loadBalancer/targetSet/{TARGET_SET_ID}/registerTargets?accountId={ACCOUNT_ID}

Create and register the specified targets with the specified target set.

URL Parameters

Parameter Type Description
TARGET_SET_ID * String

The target set id

Example: ts-12345
ACCOUNT_ID String

Account ID from Spotinst console

Example: act-12345
Request - Register Targets

Headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
    "targets":[{
      "name":"target 1",
      "host":"10.0.0.2",
      "port":1337,
      "weight":1,
      "tags": [{
            "key": "Environment",
            "value": "Production"
        }]
     },
     {
     "name":"target 2",
     "host":"10.0.0.2",
     "port":1337,
     "weight":10,
     "tags": [{
           "key": "Environment",
           "value": "Production"
       }]
     }]
  }

Body Attributes


  • targets.name String
    The name of the Target. Must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
  • targets.host String
    The host (IP or URL) of the targets to register
  • targets.port Integer
    The host port of the targets to register
  • targets.weight Integer
    Defined how the traffic is distributed between the Target
  • targets.tags.key String
    The tag’s key
  • targets.tags.value String
    The tag’s value
Response - 200

Headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "kind": "spotinst:lb:target",
  "items": [
    {
      "registeredTargetId": "t-fdf323227b78"
    },
    {
      "registeredTargetId": "t-595ff11ac283"
    }
  ],
  "count": 2
}

Response Body Attributes


  • registeredTargetId String
    the registered target ID