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
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:DescribeScalingActivities | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the scaling group to which the scaling activity that you want to query belongs. | cn-hangzhou |
PageNumber | integer | No | The page number. Pages start from page 1. Default value: 1. | 1 |
PageSize | integer | No | The number of entries per page. Maximum value: 50. Default value: 10. | 10 |
ScalingGroupId | string | No | 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**** |
StatusCode | string | No | The status of the scaling activity. Valid values:
| Successful |
ScalingActivityIds | array | No | 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.
| |
string | No | 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
Examples
Sample success responses
JSON
format
{
"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 time | Summary of changes | Operation |
---|---|---|
2024-08-27 | The request parameters of the API has changed. The response structure of the API has changed | View Change Details |
2024-03-13 | The response structure of the API has changed | View Change Details |
2022-12-16 | The response structure of the API has changed | View Change Details |