Menu
Auto Scaling
API Reference (API Version 2011-01-01)

TerminateInstanceInAutoScalingGroup

Terminates the specified instance and optionally adjusts the desired group size.

This call simply makes a termination request. The instance is not terminated immediately.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

InstanceId

The ID of the instance.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 19.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: Yes

ShouldDecrementDesiredCapacity

If true, terminating the instance also decrements the size of the Auto Scaling group.

Type: Boolean

Required: Yes

Response Elements

The following element is returned by the service.

Activity

A scaling activity.

Type: Activity object

Errors

For information about the errors that are common to all actions, see Common Errors.

ResourceContention

You already have a pending update to an Auto Scaling resource (for example, a group, instance, or load balancer).

HTTP Status Code: 500

ScalingActivityInProgress

The operation can't be performed because there are scaling activities in progress.

HTTP Status Code: 400

Example

Sample Request

Copy
https://autoscaling.amazonaws.com/?Action=TerminateInstanceInAutoScalingGroup &InstanceId=i-12345678 &ShouldDecrementDesiredCapacity=true &Version=2011-01-01 &AUTHPARAMS

Sample Response

Copy
<TerminateInstanceInAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/"> <TerminateInstanceInAutoScalingGroupResult> <Activity> <ActivityId>12345678-1234-1234-1234-123456789012</ActivityId> <Description>Terminating EC2 instance: i-12345678</Description> <Progress>0</Progress> <Cause>At 2015-06-14T00:07:30Z instance i-12345678 was taken out of service in response to a user request, shrinking the capacity from 4 to 3.</Cause> <StartTime>2015-06-14T00:07:30.280Z</StartTime> <Details>{"Availability Zone":"us-east-1a","SubnetID":"subnet-12345678"}</Details> <StatusCode>InProgress</StatusCode> </Activity> </TerminateInstanceInAutoScalingGroupResult> <ResponseMetadata> <RequestId>7c6e177f-f082-11e1-ac58-3714bEXAMPLE</RequestId> </ResponseMetadata> </TerminateInstanceInAutoScalingGroupResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: