選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

TerminateInstanceInAutoScalingGroup - Amazon EC2 Auto Scaling
此頁面尚未翻譯為您的語言。 請求翻譯

TerminateInstanceInAutoScalingGroup

Terminates the specified instance and optionally adjusts the desired group size. This operation cannot be called on instances in a warm pool.

This call simply makes a termination request. The instance is not terminated immediately. When an instance is terminated, the instance status changes to terminated. You can't connect to or start an instance after you've terminated it.

If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are terminated.

By default, Amazon EC2 Auto Scaling balances instances across all Availability Zones. If you decrement the desired capacity, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries to rebalance the group, and rebalancing might terminate instances in other zones. For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.

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

Indicates whether 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 Amazon EC2 Auto Scaling resource (for example, an Auto Scaling 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

Examples

Example

This example illustrates one usage of TerminateInstanceInAutoScalingGroup.

Sample Request

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

Sample Response

<TerminateInstanceInAutoScalingGroupResponse xmlns="https://autoscaling.amazonaws.com/doc/2011-01-01/"> <TerminateInstanceInAutoScalingGroupResult> <Activity> <AutoScalingGroupName>my-asg</AutoScalingGroupName> <ActivityId>12345678-1234-1234-1234-123456789012</ActivityId> <Description>Terminating EC2 instance: i-1234567890abcdef0</Description> <Cause>At 2022-06-14T00:07:30Z instance i-1234567890abcdef0 was taken out of service in response to a user request, shrinking the capacity from 4 to 3.</Cause> <StartTime>2022-06-14T00:07:30.280Z</StartTime> <Details>{"Availability Zone":"us-east-1a","SubnetID":"subnet-057fa0918fEXAMPLE"}</Details> <Progress>0</Progress> <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:

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。