All Products
Search
Document Center

Auto Scaling:DescribeScalingActivities

Last Updated:Dec 11, 2024

Queries scaling activities. You can call the DescribeScalingActivities operation to query the results of scaling activities triggered by scheduled tasks, event-triggered tasks, or manual execution of scaling rules. For example, you can query the status and cause of a scaling activity. You can also query the total number of instances after a scaling activity is complete.

Operation description

  • You can query all scaling activities in a scaling group by specifying ScalingGroupId.
  • You can filter query results based on the status of scaling activities.
  • You can query scaling activities within the last 30 days.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ess:DescribeScalingActivitiesget
*ScalingGroup
acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the scaling group to which the scaling activity that you want to query belongs.

cn-hangzhou
PageNumberintegerNo

The page number. Pages start from page 1.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page. Maximum value: 50.

Default value: 10.

10
ScalingGroupIdstringNo

The ID of the scaling group.

Note When you call this operation, you must specify one of the following parameters: ScalingGroupId and ScalingActivityIds. You cannot specify both of them at the same time. If you specify neither of them, an error is reported.
asg-bp18p2yfxow2dloq****
StatusCodestringNo

The status of the scaling activity. Valid values:

  • Successful: The scaling activity is successful.
  • Warning: The scaling activity is partially successful.
  • Failed: The scaling activity failed.
  • InProgress: The scaling activity is in progress.
  • Rejected: The request to trigger the scaling activity is rejected.
Successful
ScalingActivityIdsarrayNo

The IDs of the scaling activities that you want to query.

Note When you call this operation, you must specify one of the following parameters: ScalingGroupId and ScalingActivityIds. You cannot specify both of them at the same time. If you specify neither of them, an error is reported.
stringNo

The ID of the scaling activity that you want to query.

Note When you call this operation, you must specify one of the following parameters: ScalingGroupId and ScalingActivityIds. You cannot specify both of them at the same time. If you specify neither of them, an error is reported.
asa-bp161xudmuxdzofe****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

CC107349-57B7-4405-B1BF-9BF5AF7F2A46
PageNumberinteger

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

10
TotalCountinteger

The total number of scaling activities.

1
ScalingActivitiesarray<object>

The scaling activities.

ScalingActivityobject

The scaling activity.

Progressinteger

The execution progress of the scaling activity.

100
ScalingInstanceNumberinteger
  • If you query a scale-out activity, the value of this parameter indicates the number of instances that are created or the number of instances that are started from Economical Mode.
  • If you query a scale-in activity, the value of this parameter indicates the number of instances that are deleted or the number of instances that are stopped in Economical Mode.
1
AttachedCapacitystring

The total number of instances that are manually added to the scaling group after the scaling activity is complete.

0
TotalCapacitystring

The total number of instances in the scaling group after the scaling activity was complete.

2
ScalingGroupIdstring

The ID of the scaling group.

asg-bp18p2yfxow2dloq****
AutoCreatedCapacitystring

The total number of instances that are created by Auto Scaling after the scaling activity was complete.

2
EndTimestring

The time when the scaling activity was complete.

2020-09-10T09:54Z
StartTimestring

The time when the scaling activity was started.

2020-09-10T09:54Z
Descriptionstring

The description of the scaling activity.

Add \"1\" ECS instance
StatusCodestring

The status of the scaling activity. Valid values:

  • Successful: The scaling activity is successful.
  • Warning: The scaling activity is partially successful.
  • Failed: The scaling activity failed.
  • InProgress: The scaling activity is in progress.
  • Rejected: The request to trigger the scaling activity is rejected.
Successful
Causestring

The reason why the scaling activity was triggered.

A user requests to execute scaling rule \"asr-bp12tcnol686y1ik****\", changing the Total Capacity from \"1\" to \"2\".
ScalingActivityIdstring

The ID of the scaling activity.

asa-bp161xudmuxdzofe****
StatusMessagestring

The status message of the scaling activity.

\"1\" ECS instances are added
CreatedCapacityinteger

The number of instances that are created during the scale-out event.

1
DestroyedCapacityinteger

The number of instances that are released during the scale-in event.

1
StartedCapacityinteger

The number of instances that are started from the Economical Mode during the scale-out event.

1
StoppedCapacityinteger

The number of instances that are stopped in the Economical Mode during the scale-in event.

1
CreatedInstancesarray

The instances that are created during the scale-out event.

CreatedInstancestring

The instances that are created during the scale-out event.

["i-abc1","i-abc2"]
DestroyedInstancesarray

The instances that are released during the scale-in event.

DestroyedInstancestring

The instances that are released during the scale-in event.

[ "i-abc1", "i-abc2" ]
StartedInstancesarray

The instances that are started from the Economical Mode during the scale-out event.

StartedInstancestring

The instances that are started from the Economical Mode during the scale-out event.

[ "i-abc1", "i-abc2" ]
StoppedInstancesarray

The instances that are stopped in the Economical Mode during the scale-in event.

StoppedInstancestring

The instances that are stopped in the Economical Mode during the scale-in event.

[ "i-abc1", "i-abc2" ]
ErrorCodestring

The error code that is returned when the scaling activity failed.

OperationDenied.NoStock
ErrorMessagestring

The error message that is returned when the scaling activity failed.

The specified ECS resource is out of stock in this region. Please try again later.
Detailstring

Details of the scaling activity.

"new ECS instances "i-j6c8ilerw, i-j6c8iler4mx" are created."
TriggerSourceTypestring

The type of the trigger source of the scaling activity. Valid values:

  • Cms: The scaling activity is triggered by an event-triggered task.
  • APIs: The scaling activity is triggered by calling an API operation.
  • Ess: The scaling activity is triggered by Auto Scaling.
Api
TriggerSourceIdstring

The ID of the trigger source of the scaling activity. Valid values:

  • If the scaling activity is triggered by an event-triggered task, the ID of the trigger source is the ID of the event-triggered task.
  • If the scaling activity is triggered by calling an API operation, the ID of the trigger source is the ID of the Alibaba Cloud account or Resource Access Management (RAM) user that you use to call the API operation.
  • If the scaling activity is triggered by Auto Scaling, the ID of the trigger source is null.
2346366580*****
LifecycleHookContextobject

The context of the lifecycle hook.

DisableLifecycleHookboolean

Indicates whether all lifecycle hooks are disabled when the scaling activity is triggered. Valid values:

  • true
  • false
false
IgnoredLifecycleHookIdsarray

The IDs of the lifecycle hooks that are disabled.

IgnoredLifecycleHookIdstring

The ID of the lifecycle hook that is disabled.

ash-bp14zolna43z266bq***
ActivityMetadatastring

The metadata of the scaling activity.

{\"goatscaler.io/managed\":\"true\"}

Examples

Sample success responses

JSONformat

{
  "RequestId": "CC107349-57B7-4405-B1BF-9BF5AF7F2A46",
  "PageNumber": 1,
  "PageSize": 10,
  "TotalCount": 1,
  "ScalingActivities": [
    {
      "Progress": 100,
      "ScalingInstanceNumber": 1,
      "AttachedCapacity": "0",
      "TotalCapacity": "2",
      "ScalingGroupId": "asg-bp18p2yfxow2dloq****",
      "AutoCreatedCapacity": "2",
      "EndTime": "2020-09-10T09:54Z",
      "StartTime": "2020-09-10T09:54Z",
      "Description": "Add \\\"1\\\" ECS instance",
      "StatusCode": "Successful",
      "Cause": "A user requests to execute scaling rule \\\"asr-bp12tcnol686y1ik****\\\", changing the Total Capacity from \\\"1\\\" to \\\"2\\\".",
      "ScalingActivityId": "asa-bp161xudmuxdzofe****",
      "StatusMessage": "\\\"1\\\" ECS instances are added",
      "CreatedCapacity": 1,
      "DestroyedCapacity": 1,
      "StartedCapacity": 1,
      "StoppedCapacity": 1,
      "CreatedInstances": [
        "[\"i-abc1\",\"i-abc2\"]"
      ],
      "DestroyedInstances": [
        "[\n      \"i-abc1\",\n      \"i-abc2\"\n]"
      ],
      "StartedInstances": [
        "[\n      \"i-abc1\",\n      \"i-abc2\"\n]"
      ],
      "StoppedInstances": [
        "[\n      \"i-abc1\",\n      \"i-abc2\"\n]"
      ],
      "ErrorCode": "OperationDenied.NoStock",
      "ErrorMessage": "The specified ECS resource is out of stock in this region. Please try again later.",
      "Detail": "\"new ECS instances \"i-j6c8ilerw, i-j6c8iler4mx\" are created.\"",
      "TriggerSourceType": "Api",
      "TriggerSourceId": "2346366580*****",
      "LifecycleHookContext": {
        "DisableLifecycleHook": false,
        "IgnoredLifecycleHookIds": [
          "ash-bp14zolna43z266bq***\n"
        ]
      },
      "ActivityMetadata": "{\\\"goatscaler.io/managed\\\":\\\"true\\\"}",
      "InstanceRefreshTaskId": "ir-asdf12adsxg*****"
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-08-27The request parameters of the API has changed. The response structure of the API has changedView Change Details
2024-03-13The response structure of the API has changedView Change Details
2022-12-16The response structure of the API has changedView Change Details