Auto Scaling

2021/02/23 - Auto Scaling - 5 updated api methods

Changes  Adds a new optional IncludeDeletedGroups parameter to the DescribeScalingActivities API.

DescribeScalingActivities (updated) Link ¶
Changes (request, response)
Request
{'IncludeDeletedGroups': 'boolean'}
Response
{'Activities': {'AutoScalingGroupARN': 'string',
                'AutoScalingGroupState': 'string'}}

Describes one or more scaling activities for the specified Auto Scaling group.

To view the scaling activities from the Amazon EC2 Auto Scaling console, choose the Activity tab of the Auto Scaling group. When scaling events occur, you see scaling activity messages in the Activity history . For more information, see Verifying a scaling activity for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

client.describe_scaling_activities(
    ActivityIds=[
        'string',
    ],
    AutoScalingGroupName='string',
    IncludeDeletedGroups=True|False,
    MaxRecords=123,
    NextToken='string'
)
type ActivityIds

list

param ActivityIds

The activity IDs of the desired scaling activities. You can specify up to 50 IDs. If you omit this parameter, all activities for the past six weeks are described. If unknown activities are requested, they are ignored with no error. If you specify an Auto Scaling group, the results are limited to that group.

  • (string) --

type AutoScalingGroupName

string

param AutoScalingGroupName

The name of the Auto Scaling group.

type IncludeDeletedGroups

boolean

param IncludeDeletedGroups

Indicates whether to include scaling activity from deleted Auto Scaling groups.

type MaxRecords

integer

param MaxRecords

The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

rtype

dict

returns

Response Syntax

{
    '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',
            'StatusMessage': 'string',
            'Progress': 123,
            'Details': 'string',
            'AutoScalingGroupState': 'string',
            'AutoScalingGroupARN': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Activities (list) --

      The scaling activities. Activities are sorted by start time. Activities still in progress are described first.

      • (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.

    • NextToken (string) --

      A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.

DetachInstances (updated) Link ¶
Changes (response)
{'Activities': {'AutoScalingGroupARN': 'string',
                'AutoScalingGroupState': 'string'}}

Removes one or more instances from the specified Auto Scaling group.

After the instances are detached, you can manage them independent of the Auto Scaling group.

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

If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.

For more information, see Detach EC2 instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

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

list

param InstanceIds

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

  • (string) --

type AutoScalingGroupName

string

param AutoScalingGroupName

[REQUIRED]

The name of the Auto Scaling group.

type ShouldDecrementDesiredCapacity

boolean

param ShouldDecrementDesiredCapacity

[REQUIRED]

Indicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.

rtype

dict

returns

Response Syntax

{
    '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',
            'StatusMessage': 'string',
            'Progress': 123,
            'Details': 'string',
            'AutoScalingGroupState': 'string',
            'AutoScalingGroupARN': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Activities (list) --

      The activities related to detaching 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.

EnterStandby (updated) Link ¶
Changes (response)
{'Activities': {'AutoScalingGroupARN': 'string',
                'AutoScalingGroupState': 'string'}}

Moves the specified instances into the standby state.

If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.

If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.

For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

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

list

param InstanceIds

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

  • (string) --

type AutoScalingGroupName

string

param AutoScalingGroupName

[REQUIRED]

The name of the Auto Scaling group.

type ShouldDecrementDesiredCapacity

boolean

param ShouldDecrementDesiredCapacity

[REQUIRED]

Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to Standby mode.

rtype

dict

returns

Response Syntax

{
    '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',
            'StatusMessage': 'string',
            'Progress': 123,
            'Details': 'string',
            'AutoScalingGroupState': 'string',
            'AutoScalingGroupARN': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Activities (list) --

      The activities related to moving instances into Standby mode.

      • (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.

ExitStandby (updated) Link ¶
Changes (response)
{'Activities': {'AutoScalingGroupARN': 'string',
                'AutoScalingGroupState': 'string'}}

Moves the specified instances out of the standby state.

After you put the instances back in service, the desired capacity is incremented.

For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

client.exit_standby(
    InstanceIds=[
        'string',
    ],
    AutoScalingGroupName='string'
)
type InstanceIds

list

param InstanceIds

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

  • (string) --

type AutoScalingGroupName

string

param AutoScalingGroupName

[REQUIRED]

The name of the Auto Scaling group.

rtype

dict

returns

Response Syntax

{
    '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',
            'StatusMessage': 'string',
            'Progress': 123,
            'Details': 'string',
            'AutoScalingGroupState': 'string',
            'AutoScalingGroupARN': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Activities (list) --

      The activities related to moving instances out of Standby mode.

      • (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.

TerminateInstanceInAutoScalingGroup (updated) Link ¶
Changes (response)
{'Activity': {'AutoScalingGroupARN': 'string',
              'AutoScalingGroupState': 'string'}}

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

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 Rebalancing activities in the Amazon EC2 Auto Scaling User Guide .

See also: AWS API Documentation

Request Syntax

client.terminate_instance_in_auto_scaling_group(
    InstanceId='string',
    ShouldDecrementDesiredCapacity=True|False
)
type InstanceId

string

param InstanceId

[REQUIRED]

The ID of the instance.

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',
        '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.