fbpx
POSThttps://api.spotinst.io/loadBalancer/targetSet?accountId={ACCOUNT_ID}

Create a new target set

URL Parameter

Parameter Type Description
ACCOUNT_ID String

Account ID from Spotinst Console

Example: act-12345
Request

Headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "targetSet": {
    "name": "targetSet1",
    "balancerId": "lb-5470a9fb",
    "deploymentId": "de-12345",
    "protocol": "HTTP",
    "weight": 1,
    "config": {
      "rateLimiter": {
        "requestsPerSecond": 10
      }
    },
    "integrations": {
      "ecs": [
        {
          "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:12345:targetgroup/MyTargetGroup/12345",
          "targetGroupName": "MyTargetGroup",
          "region": "us-east-1",
          "serviceName": "11",
          "clusterName": "22"
        }
      ]
    },
    "healthCheck": {
      "interval": 10,
      "path": "/healthCheck",
      "port": 80,
      "protocol": "HTTP",
      "timeout": 5,
      "healthyThresholdCount": 2,
      "unhealthyThresholdCount": 3
    },
    "tags": [
      {
        "key": "Environment",
        "value": "Production"
      }
    ]
  }
}

Body Attributes


  • targetSet.name * String
    The name of the Target Set. Must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
  • targetSet.balancerId * String
    The id of the balancer
  • targetSet.deploymentId * String
    The id of the deployment
  • targetSet.protocol * String
    The protocol to allow connections to the target
  • targetSet.weight * Integer
    Defined how the traffic is distributed between the Target Set
  • config.rateLimiter.requestsPerSecond Integer
    Limit the number of requests per second, per target set. Requests that exceed this limit will be routed to the default targetSet.
  • targetSet.healthCheck.interval * Integer
    The interval for the health check
  • targetSet.healthCheck.path * String
    The path to perform the health check
  • targetSet.healthCheck.port * Integer
    The port on which the load balancer is listening.
  • targetSet.healthCheck.protocol * String
    The protocol to allow connections to the target for the health check
  • targetSet.healthCheck.timeout * Integer
    The time out for the health check
  • targetSet.healthCheck.healthyThresholdCount * Integer
    Total number of allowed healthy Targets
  • targetSet.healthCheck.unhealthyThresholdCount * Integer
    Total number of allowed unheathy Targets
  • targetSet.tags.key String
    The tag’s key
  • targetSet.tags.value String
    The tag’s value
  • targetSet. integrations.ecs.targetGroupArn String
    The Arn of the target set used for the MLB-ECS integration.
    Example: arn:aws:elasticloadbalancing:us-east-1:12345:targetgroup/MyTargetGroup/12345
  • targetSet. integrations.ecs.targetGroupName String
    The name of the target set used for the MLB-ECS integration.
    Example: MyTargetGroup
  • targetSet. integrations.ecs.region String
    The region of the target set used for the MLB-ECS integration.
    Example: us-east-1
  • targetSet. integrations.ecs.serviceName String
    The name you give the ECS service under the MLB
    Example: 11
  • targetSet. integrations.ecs. clusterName String
    The name you give the ECS cluster under the MLB
    Example: 22
Response - 200

Headers
{
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "kind": "spotinst:lb:targetSet",
  "items": [
    {
      "id": "ts-12345",
      "deploymentId": "de-12345",
      "name": "targetSet1",
      "balancerId": "lb-5470a9fb",
      "protocol": "HTTP",
      "port": null,
      "weight": 1,
      "healthCheck": {
        "interval": 10,
        "path": "/healthCheck",
        "port": 80,
        "protocol": "HTTP",
        "timeout": 5,
        "healthyThresholdCount": 2,
        "unhealthyThresholdCount": 3
      },
      "tags": [
        {
          "key": "Environment",
          "value": "Production"
        }
      ]
    }
  ],
  "count": 1
}