AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DescribeScalingActivities
与 a 一起使用 CLI
以下代码示例演示如何使用 DescribeScalingActivities
。
- CLI
-
- AWS CLI
-
示例 1:描述指定 Amazon ECS 服务的扩展活动
以下
describe-scaling-activities
示例描述了default
集群中运行的名为web-app
Amazon ECS 服务的扩展活动。输出显示了由扩展策略启动的扩展活动。aws application-autoscaling describe-scaling-activities \ --service-namespace
ecs
\ --resource-idservice/default/web-app
输出:
{ "ScalingActivities": [ { "ScalableDimension": "ecs:service:DesiredCount", "Description": "Setting desired count to 1.", "ResourceId": "service/default/web-app", "ActivityId": "e6c5f7d1-dbbb-4a3f-89b2-51f33e766399", "StartTime": 1462575838.171, "ServiceNamespace": "ecs", "EndTime": 1462575872.111, "Cause": "monitor alarm web-app-cpu-lt-25 in state ALARM triggered policy web-app-cpu-lt-25", "StatusMessage": "Successfully set desired count to 1. Change successfully fulfilled by ecs.", "StatusCode": "Successful" } ] }
有关更多信息,请参阅《Auto Scaling Auto Scaling 用户指南》中的应用程序 Auto Scaling 的扩展活动。
示例 2:描述指定 DynamoDB 表的扩展活动
以下
describe-scaling-activities
示例描述了名为的 DynamoDB 表的扩展活动。TestTable
输出显示了由两个不同的计划操作启动的扩展活动。aws application-autoscaling describe-scaling-activities \ --service-namespace
dynamodb
\ --resource-idtable/TestTable
输出:
{ "ScalingActivities": [ { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting write capacity units to 10.", "ResourceId": "table/my-table", "ActivityId": "4d1308c0-bbcf-4514-a673-b0220ae38547", "StartTime": 1561574415.086, "ServiceNamespace": "dynamodb", "EndTime": 1561574449.51, "Cause": "maximum capacity was set to 10", "StatusMessage": "Successfully set write capacity units to 10. Change successfully fulfilled by dynamodb.", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting min capacity to 5 and max capacity to 10", "ResourceId": "table/my-table", "ActivityId": "f2b7847b-721d-4e01-8ef0-0c8d3bacc1c7", "StartTime": 1561574414.644, "ServiceNamespace": "dynamodb", "Cause": "scheduled action name my-second-scheduled-action was triggered", "StatusMessage": "Successfully set min capacity to 5 and max capacity to 10", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting write capacity units to 15.", "ResourceId": "table/my-table", "ActivityId": "d8ea4de6-9eaa-499f-b466-2cc5e681ba8b", "StartTime": 1561574108.904, "ServiceNamespace": "dynamodb", "EndTime": 1561574140.255, "Cause": "minimum capacity was set to 15", "StatusMessage": "Successfully set write capacity units to 15. Change successfully fulfilled by dynamodb.", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting min capacity to 15 and max capacity to 20", "ResourceId": "table/my-table", "ActivityId": "3250fd06-6940-4e8e-bb1f-d494db7554d2", "StartTime": 1561574108.512, "ServiceNamespace": "dynamodb", "Cause": "scheduled action name my-first-scheduled-action was triggered", "StatusMessage": "Successfully set min capacity to 15 and max capacity to 20", "StatusCode": "Successful" } ] }
有关更多信息,请参阅《Auto Scaling Auto Scaling 用户指南》中的应用程序 Auto Scaling 的扩展活动。
-
有关API详细信息,请参阅 “DescribeScalingActivities AWS CLI
命令参考”。
-
- PowerShell
-
- 用于 PowerShell
-
示例 1:提供有关前六周指定命名空间中扩展活动的描述性信息。
Get-AASScalingActivity -ServiceNamespace AppStream
输出:
ActivityId : 2827409f-b639-4cdb-a957-8055d5d07434 Cause : monitor alarm Appstream2-MyFleet-default-scale-in-Alarm in state ALARM triggered policy default-scale-in Description : Setting desired capacity to 2. Details : EndTime : 12/14/2019 11:32:49 AM ResourceId : fleet/MyFleet ScalableDimension : appstream:fleet:DesiredCapacity ServiceNamespace : appstream StartTime : 12/14/2019 11:32:14 AM StatusCode : Successful StatusMessage : Successfully set desired capacity to 2. Change successfully fulfilled by appstream.
-
有关API详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考DescribeScalingActivities中的。
-
DescribeScalableTargets
DescribeScalingPolicies