Auto Scaling

2026/08/13 - Auto Scaling - 1 updated api methods

Changes  Amazon EC2 Auto Scaling now supports terminating multiple instances in a single TerminateInstanceInAutoScalingGroup call via the new InstanceIds parameter, returning an Activities list. LaunchInstances now returns IdempotentCallInProgressFault for duplicate client tokens.

TerminateInstanceInAutoScalingGroup (updated) Link ΒΆ
Changes (request, response)
Request
{'AutoScalingGroupName': 'string', 'InstanceIds': ['string']}
Response
{'Activities': [{'ActivityId': 'string',
                 'AutoScalingGroupARN': 'string',
                 'AutoScalingGroupName': 'string',
                 'AutoScalingGroupState': 'string',
                 'Cause': 'string',
                 'Description': 'string',
                 'Details': 'string',
                 'EndTime': 'timestamp',
                 'Progress': 'integer',
                 'StartTime': 'timestamp',
                 'StatusCode': 'PendingSpotBidPlacement | '
                               'WaitingForSpotInstanceRequestId | '
                               'WaitingForSpotInstanceId | '
                               'WaitingForInstanceId | PreInService | '
                               'InProgress | WaitingForELBConnectionDraining | '
                               'MidLifecycleAction | WaitingForInstanceWarmup '
                               '| Successful | Failed | Cancelled | '
                               'WaitingForConnectionDraining | '
                               'WaitingForInPlaceUpdateToStart | '
                               'WaitingForInPlaceUpdateToFinalize | '
                               'InPlaceUpdateInProgress',
                 'StatusMessage': 'string'}]}

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 instances are 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.

To terminate multiple instances in a single call, use the InstanceIds and AutoScalingGroupName parameters instead of InstanceId. When terminating multiple instances, the response populates Activities instead of Activity.

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.

See also: AWS API Documentation

Request Syntax

client.terminate_instance_in_auto_scaling_group(
    InstanceId='string',
    InstanceIds=[
        'string',
    ],
    AutoScalingGroupName='string',
    ShouldDecrementDesiredCapacity=True|False
)
type InstanceId:

string

param InstanceId:

The ID of the instance.

type InstanceIds:

list

param InstanceIds:

The IDs of the instances. You can specify up to 100 instances.

This parameter requires that you also specify AutoScalingGroupName.

  • (string) --

type AutoScalingGroupName:

string

param AutoScalingGroupName:

The name of the Auto Scaling group. Required when using InstanceIds.

type ShouldDecrementDesiredCapacity:

boolean

param ShouldDecrementDesiredCapacity:

[REQUIRED]

Indicates whether terminating the instance also decrements the size of the Auto Scaling group.

rtype:

dict

returns:

Response Syntax

{
    'Activity': {
        'ActivityId': 'string',
        'AutoScalingGroupName': 'string',
        'Description': 'string',
        'Cause': 'string',
        'StartTime': datetime(2015, 1, 1),
        'EndTime': datetime(2015, 1, 1),
        'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled'|'WaitingForConnectionDraining'|'WaitingForInPlaceUpdateToStart'|'WaitingForInPlaceUpdateToFinalize'|'InPlaceUpdateInProgress',
        'StatusMessage': 'string',
        'Progress': 123,
        'Details': 'string',
        'AutoScalingGroupState': 'string',
        'AutoScalingGroupARN': 'string'
    },
    'Activities': [
        {
            'ActivityId': 'string',
            'AutoScalingGroupName': 'string',
            'Description': 'string',
            'Cause': 'string',
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1),
            'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled'|'WaitingForConnectionDraining'|'WaitingForInPlaceUpdateToStart'|'WaitingForInPlaceUpdateToFinalize'|'InPlaceUpdateInProgress',
            'StatusMessage': 'string',
            'Progress': 123,
            'Details': 'string',
            'AutoScalingGroupState': 'string',
            'AutoScalingGroupARN': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Activity (dict) --

      A scaling activity.

      • ActivityId (string) --

        The ID of the activity.

      • AutoScalingGroupName (string) --

        The name of the Auto Scaling group.

      • Description (string) --

        A friendly, more verbose description of the activity.

      • Cause (string) --

        The reason the activity began.

      • StartTime (datetime) --

        The start time of the activity.

      • EndTime (datetime) --

        The end time of the activity.

      • StatusCode (string) --

        The current status of the activity.

      • StatusMessage (string) --

        A friendly, more verbose description of the activity status.

      • Progress (integer) --

        A value between 0 and 100 that indicates the progress of the activity.

      • Details (string) --

        The details about the activity.

      • AutoScalingGroupState (string) --

        The state of the Auto Scaling group, which is either InService or Deleted.

      • AutoScalingGroupARN (string) --

        The Amazon Resource Name (ARN) of the Auto Scaling group.

    • Activities (list) --

      The scaling activities related to terminating the instances from the Auto Scaling group.

      • (dict) --

        Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.

        • ActivityId (string) --

          The ID of the activity.

        • AutoScalingGroupName (string) --

          The name of the Auto Scaling group.

        • Description (string) --

          A friendly, more verbose description of the activity.

        • Cause (string) --

          The reason the activity began.

        • StartTime (datetime) --

          The start time of the activity.

        • EndTime (datetime) --

          The end time of the activity.

        • StatusCode (string) --

          The current status of the activity.

        • StatusMessage (string) --

          A friendly, more verbose description of the activity status.

        • Progress (integer) --

          A value between 0 and 100 that indicates the progress of the activity.

        • Details (string) --

          The details about the activity.

        • AutoScalingGroupState (string) --

          The state of the Auto Scaling group, which is either InService or Deleted.

        • AutoScalingGroupARN (string) --

          The Amazon Resource Name (ARN) of the Auto Scaling group.