与 AWS SDK或DescribeScalableTargets一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或DescribeScalableTargets一起使用 CLI

以下代码示例演示如何使用 DescribeScalableTargets

CLI
AWS CLI

描述可扩展的目标

以下describe-scalable-targets示例描述了ecs服务命名空间的可扩展目标。

aws application-autoscaling describe-scalable-targets \ --service-namespace ecs

输出:

{ "ScalableTargets": [ { "ServiceNamespace": "ecs", "ScalableDimension": "ecs:service:DesiredCount", "ResourceId": "service/default/web-app", "MinCapacity": 1, "MaxCapacity": 10, "RoleARN": "arn:aws:iam::123456789012:role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService", "CreationTime": 1462558906.199, "SuspendedState": { "DynamicScalingOutSuspended": false, "ScheduledScalingSuspended": false, "DynamicScalingInSuspended": false }, "ScalableTargetARN": "arn:aws:application-autoscaling:us-west-2:123456789012:scalable-target/1234abcd56ab78cd901ef1234567890ab123" } ] }

有关更多信息,请参阅《应用程序自动缩放用户指南》中的可用于 Application Auto Scaling 的AWS 服务

PowerShell
用于 PowerShell

示例 1:此示例将提供有关指定命名空间中应用程序自动缩放可扩展目标的信息。

Get-AASScalableTarget -ServiceNamespace "AppStream"

输出:

CreationTime : 11/7/2019 2:30:03 AM MaxCapacity : 5 MinCapacity : 1 ResourceId : fleet/Test RoleARN : arn:aws:iam::012345678912:role/aws-service-role/appstream.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_AppStreamFleet ScalableDimension : appstream:fleet:DesiredCapacity ServiceNamespace : appstream SuspendedState : Amazon.ApplicationAutoScaling.Model.SuspendedState