AutoScaling / Client / describe_scaling_activities

describe_scaling_activities#

AutoScaling.Client.describe_scaling_activities(**kwargs)#

Gets information about the scaling activities in the account and Region.

When scaling events occur, you see a record of the scaling activity in the scaling activities. For more information, see Verifying a scaling activity for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.

If the scaling event succeeds, the value of the StatusCode element in the response is Successful. If an attempt to launch instances failed, the StatusCode value is Failed or Cancelled and the StatusMessage element in the response indicates the cause of the failure. For help interpreting the StatusMessage, see Troubleshooting Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

See also: AWS API Documentation

Request Syntax

response = client.describe_scaling_activities(
    ActivityIds=[
        'string',
    ],
    AutoScalingGroupName='string',
    IncludeDeletedGroups=True|False,
    MaxRecords=123,
    NextToken='string'
)
Parameters:
  • ActivityIds (list) –

    The activity IDs of the desired scaling activities. If you omit this property, 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.

    Array Members: Maximum number of 50 IDs.

    • (string) –

  • AutoScalingGroupName (string) – The name of the Auto Scaling group.

  • IncludeDeletedGroups (boolean) – Indicates whether to include scaling activity from deleted Auto Scaling groups.

  • MaxRecords (integer) – The maximum number of items to return with this call. The default value is 100 and the maximum value is 100.

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

Return type:

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

Exceptions

  • AutoScaling.Client.exceptions.InvalidNextToken

  • AutoScaling.Client.exceptions.ResourceContentionFault

Examples

This example describes the scaling activities for the specified Auto Scaling group.

response = client.describe_scaling_activities(
    AutoScalingGroupName='my-auto-scaling-group',
)

print(response)

Expected Output:

{
    'Activities': [
        {
            'ActivityId': 'f9f2d65b-f1f2-43e7-b46d-d86756459699',
            'AutoScalingGroupARN': 'arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:12345678-1234-1234-1234-123456789012:autoScalingGroupName/my-auto-scaling-group',
            'AutoScalingGroupName': 'my-auto-scaling-group',
            'Cause': 'At 2013-08-19T20:53:25Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1.  At 2013-08-19T20:53:29Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.',
            'Description': 'Launching a new EC2 instance: i-4ba0837f',
            'Details': 'details',
            'EndTime': datetime(2013, 8, 19, 20, 54, 2, 0, 231, 0),
            'Progress': 100,
            'StartTime': datetime(2013, 8, 19, 20, 53, 29, 0, 231, 0),
            'StatusCode': 'Successful',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}