All Products
Search
Document Center

Auto Scaling:DescribeScalingActivities

Last Updated:Jun 26, 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.

Usage notes

  • You can specify a scaling group ID to query all scaling activities in the scaling group.

  • You can filter query results based on the status of scaling activities.

  • You can query scaling activities that are executed in the previous 30 days.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DescribeScalingActivities

The operation that you want to perform. Set the value to DescribeScalingActivities.

RegionId

String

Yes

cn-hangzhou

The region ID of the scaling group to which the scaling activity belongs.

PageNumber

Integer

No

1

The page number. Pages start from page 1.

Default value: 1.

PageSize

Integer

No

10

The number of entries per page. Valid values: 1 to 50.

Default value: 10.

ScalingGroupId

String

No

asg-bp18p2yfxow2dloq****

The ID of the scaling group.

Note

When you call this operation, you must select one of ScalingGroupId and ScalingActivityId.N to specify. If you leave them empty, an error will be reported.

StatusCode

String

No

Successful

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.

ScalingActivityId.N

String

No

asa-bp161xudmuxdzofe****

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

Note

When you call this operation, you must select one of ScalingGroupId and ScalingActivityId.N to specify. If you leave them empty, an error will be reported.

Response parameters

Parameter

Type

Example

Description

RequestId

String

CC107349-57B7-4405-B1BF-9BF5AF7F****

The request ID.

PageNumber

Integer

1

The page number.

PageSize

Integer

10

The number of entries per page.

TotalCount

Integer

1

The total number of scaling activities.

ScalingActivities

Array of ScalingActivity

The information about the scaling activities.

ScalingActivity

Progress

Integer

100

The execution progress of the scaling activity.

ScalingInstanceNumber

Integer

1

  • If you query a scale-out activity, the value of this parameter indicates the number of instances that were created or the number of instances that were started from the Economical Mode during the scale-out activity.

  • If you query a scale-in activity, the value of this parameter indicates the number of instances that were deleted or the number of instances that were stopped in the Economical Mode during the scale-in activity.

AttachedCapacity

String

0

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

TotalCapacity

String

2

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

ScalingGroupId

String

asg-bp18p2yfxow2dloq****

The ID of the scaling group.

AutoCreatedCapacity

String

2

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

EndTime

String

2020-09-10T09:54Z

The time when the scaling activity ended.

StartTime

String

2020-09-10T09:54Z

The time when the scaling activity started.

Description

String

Add \"1\" ECS instance

The description of the scaling activity.

StatusCode

String

Successful

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.

Cause

String

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

The reason why the scaling activity was triggered.

ScalingActivityId

String

asa-bp161xudmuxdzofe****

The ID of the scaling activity.

StatusMessage

String

\"1\" ECS instances are added

The status information about the scaling activity.

CreatedCapacity

Integer

1

The number of instances that were created during the scale-out activity.

DestroyedCapacity

Integer

1

The number of instances that were released during the scale-in activity.

StartedCapacity

Integer

1

The number of instances that were started from Economical Mode during the scale-out activity.

StoppedCapacity

Integer

1

The number of instances that were stopped in Economical Mode during the scale-in activity.

CreatedInstances

Array of String

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

The instances that were created during the scale-out activity.

DestroyedInstances

Array of String

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

The instances that were released during the scale-in activity.

StartedInstances

Array of String

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

The instances that were started from Economical Mode during the scale-out activity.

StoppedInstances

Array of String

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

The instances that were stopped in Economical Mode during the scale-in activity.

ErrorCode

String

OperationDenied.NoStock

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

ErrorMessage

String

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

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

Detail

String

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

The details of the scaling activity.

TriggerSourceType

String

Api

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

  • Cms: The trigger source is an event-triggered task.

  • APIs: The trigger source is an API operation call.

  • Ess: The trigger source is a system task.

TriggerSourceId

String

2346366580*****

The ID of the trigger source of the scaling activity.

  • If you set TriggerSourceType to Cms, the ID of the trigger source is the ID of an event-triggered task.

  • If you set TriggerSourceType to Api, the ID of the trigger source is the ID of an Alibaba Cloud account or a Resource Access Management (RAM) user that initiates an API operation call.

  • If you set TriggerSourceType to Ess, the ID of the trigger source is null.

LifecycleHookContext

Object

The context of the lifecycle hook.

DisableLifecycleHook

Boolean

false

Indicates whether all lifecycle hooks were disabled when the scaling activity was triggered. Valid values:

  • true

  • false

IgnoredLifecycleHookIds

Array of String

ash-bp14zolna43z266bq***

The IDs of the lifecycle hooks that were disabled.

ActivityMetadata

String

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

The metadata of the scaling activity.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DescribeScalingActivities
&RegionId=cn-hangzhou
&PageNumber=1
&PageSize=10
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&StatusCode=Successful
&ScalingActivityId=["asa-bp161xudmuxdzofe****"]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "CC107349-57B7-4405-B1BF-9BF5AF7F****",
  "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" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
    "StartedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
    "StoppedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
    "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***" ]
    },
    "ActivityMetadata" : "{\\\"goatscaler.io/managed\\\":\\\"true\\\"}"
  } ]
}

Error codes

For a list of error codes, see Service error codes.