fbpx
PUThttps://api.spotinst.io/aws/ec2/group/{GROUP_ID}/detachInstances?accountId={ACCOUNT_ID}

Detach instances from your Elastigroup

URL Parameters

Parameter Type Description
GROUP_ID * String

The Elastigroup ID you want to detach instances from.

Example: sig-12345
ACCOUNT_ID String

Your Spotinst accountId associated with your token

Example: act-123abc
Request

Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "instancesToDetach": [
    "i-123456",
    "i-456798"
  ],
  "shouldTerminateInstances": true,
  "shouldDecrementTargetCapacity": false,
  "drainingTimeout": 300
}
Response - 200

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "request": {
    "id": "3213e42e-455e-4901-a185-cc3eb65fac5f",
    "url": "/aws/ec2/group/sig-12345/detachInstances",
    "method": "PUT",
    "time": "2015-06-28T15:49:11.911Z"
  },
  "response": {
    "status": {
      "code": 200,
      "message": "OK"
    },
    "kind": "spotinst:aws:ec2:detachInstances"
  }
}
Response - 400

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "request": {
    "id": "8e9baf2f-9266-43c3-ad47-d9626b081c49",
    "url": "/aws/ec2/instance/detach",
    "method": "PUT",
    "timestamp": "2017-11-16T08:23:26.461Z"
  },
  "response": {
    "status": {
      "code": 400,
      "message": "Bad Request"
    },
    "errors": [
      {
        "groupId": "sig-ebb98332",
        "code": "CANT_EXCEED_GROUP_CAPACITY",
        "message": "Can't detach and scale down. Group capacity is close to minimum"
      },
      {
        "groupId": "sig-dbc8ed7a",
        "code": "CANT_EXCEED_GROUP_CAPACITY",
        "message": "Can't detach and scale down. Group capacity is close to minimum"
      }
    ]
  }
}