Skip to content

describe_scaling_activities async

describe_scaling_activities(
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    activity_ids: Optional[ActivityIds] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    include_deleted_groups: Optional[IncludeDeletedGroups] = None,
    max_records: Optional[MaxRecords] = None,
    next_token: Optional[XmlString] = None,
    filters: Optional[Filters] = None,
) -> ActivitiesType

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 Verify 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.

Parameters:

  • activity_ids (Optional[ActivityIds], default: None ) –

    The activity IDs of the desired scaling activities. If unknown activity IDs are requested, they are ignored with no error. Only activities started within the last six weeks can be returned regardless of the activity IDs specified. If other filters are specified with the request, only results matching all filter criteria can be returned.

    Array Members: Maximum number of 50 IDs.

  • auto_scaling_group_name (Optional[XmlStringMaxLen255], default: None ) –

    The name of the Auto Scaling group.

    Omitting this property performs an account-wide operation, which can result in slower or timed-out requests.

  • include_deleted_groups (Optional[IncludeDeletedGroups], default: None ) –

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

  • max_records (Optional[MaxRecords], default: None ) –

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

  • next_token (Optional[XmlString], default: None ) –

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

  • filters (Optional[Filters], default: None ) –

    One or more filters to limit the results based on specific criteria. The following filters are supported:

    • StartTimeLowerBound - The earliest scaling activities to return based on the activity start time. Scaling activities with a start time earlier than this value are not included in the results. Only activities started within the last six weeks can be returned regardless of the value specified.

    • StartTimeUpperBound - The latest scaling activities to return based on the activity start time. Scaling activities with a start time later than this value are not included in the results. Only activities started within the last six weeks can be returned regardless of the value specified.

    • Status - The StatusCode value of the scaling activity. This filter can only be used in combination with the AutoScalingGroupName parameter. For valid StatusCode values, see Activity in the Amazon EC2 Auto Scaling API Reference.

    StartTimeLowerBound and StartTimeUpperBound accept ISO 8601 formatted timestamps. Timestamps without a timezone offset are assumed to be UTC.

    • 2000-01-18T08:15:00Z

    • 2000-01-18T16:15:00+08:00

Raises:

  • InvalidNextToken –

    The NextToken value is not valid.

  • ResourceContentionFault –

    You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

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

>>> await client.describe_scaling_activities(auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
async def describe_scaling_activities(
    self,
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    activity_ids: Optional[
        "capo_auto_scaling.types.activity_ids.ActivityIds"
    ] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    include_deleted_groups: Optional[
        "capo_auto_scaling.types.include_deleted_groups.IncludeDeletedGroups"
    ] = None,
    max_records: Optional["capo_auto_scaling.types.max_records.MaxRecords"] = None,
    next_token: Optional["capo_auto_scaling.types.xml_string.XmlString"] = None,
    filters: Optional["capo_auto_scaling.types.filters.Filters"] = None,
) -> "capo_auto_scaling.types.activities_type.ActivitiesType":
    """<p>Gets information about the scaling activities in the account and Region.</p> <p>When scaling events occur, you see a record of the scaling activity in the scaling activities. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-verify-scaling-activity.html">Verify a scaling activity for an Auto Scaling group</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> <p>If the scaling event succeeds, the value of the <code>StatusCode</code> element in the response is <code>Successful</code>. If an attempt to launch instances failed, the <code>StatusCode</code> value is <code>Failed</code> or <code>Cancelled</code> and the <code>StatusMessage</code> element in the response indicates the cause of the failure. For help interpreting the <code>StatusMessage</code>, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/CHAP_Troubleshooting.html">Troubleshooting Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. </p>

    Args:
        activity_ids: <p> The activity IDs of the desired scaling activities. If unknown activity IDs are requested, they are ignored with no error. Only activities started within the last six weeks can be returned regardless of the activity IDs specified. If other filters are specified with the request, only results matching all filter criteria can be returned. </p> <p>Array Members: Maximum number of 50 IDs.</p>
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p> <important> <p> Omitting this property performs an account-wide operation, which can result in slower or timed-out requests. </p> </important>
        include_deleted_groups: <p>Indicates whether to include scaling activity from deleted Auto Scaling groups.</p>
        max_records: <p>The maximum number of items to return with this call. The default value is <code>100</code> and the maximum value is <code>100</code>.</p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        filters: <p> One or more filters to limit the results based on specific criteria. The following filters are supported: </p> <ul> <li> <p> <code>StartTimeLowerBound</code> - The earliest scaling activities to return based on the activity start time. Scaling activities with a start time earlier than this value are not included in the results. Only activities started within the last six weeks can be returned regardless of the value specified. </p> </li> <li> <p> <code>StartTimeUpperBound</code> - The latest scaling activities to return based on the activity start time. Scaling activities with a start time later than this value are not included in the results. Only activities started within the last six weeks can be returned regardless of the value specified. </p> </li> <li> <p> <code>Status</code> - The <code>StatusCode</code> value of the scaling activity. This filter can only be used in combination with the <code>AutoScalingGroupName</code> parameter. For valid <code>StatusCode</code> values, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Activity.html">Activity</a> in the <i>Amazon EC2 Auto Scaling API Reference</i>. </p> </li> </ul> <p> <code>StartTimeLowerBound</code> and <code>StartTimeUpperBound</code> accept ISO 8601 formatted timestamps. Timestamps without a timezone offset are assumed to be UTC. </p> <ul> <li> <p> <code>2000-01-18T08:15:00Z</code> </p> </li> <li> <p> <code>2000-01-18T16:15:00+08:00</code> </p> </li> </ul>

    Raises:
        capo_auto_scaling.errors.invalid_next_token.InvalidNextToken: <p>The <code>NextToken</code> value is not valid.</p>
        capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
        capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe the scaling activities for an Auto Scaling group
        This example describes the scaling activities for the specified Auto Scaling group.

        >>> await client.describe_scaling_activities(auto_scaling_group_name='my-auto-scaling-group')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auto_scaling.types.describe_scaling_activities_type.DescribeScalingActivitiesType]",
    ) -> AsyncOperationResponse[
        "capo_auto_scaling.types.activities_type.ActivitiesType"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_scaling_activities

        (
            output,
            http_response,
        ) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_scaling_activities.async_describe_scaling_activities(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeScalingActivities")
    )
    input_: capo_auto_scaling.types.describe_scaling_activities_type.DescribeScalingActivitiesType = {}
    if activity_ids is not None:
        input_["activity_ids"] = activity_ids
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if include_deleted_groups is not None:
        input_["include_deleted_groups"] = include_deleted_groups
    if max_records is not None:
        input_["max_records"] = max_records
    if next_token is not None:
        input_["next_token"] = next_token
    if filters is not None:
        input_["filters"] = filters

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output