文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
将 DescribeNotificationConfigurations
与 CLI 配合使用
以下代码示例演示如何使用 DescribeNotificationConfigurations
。
- AWS CLI
-
示例 1:描述指定组的通知配置
此示例描述指定自动扩缩组的通知配置。
aws autoscaling describe-notification-configurations \ --auto-scaling-group-name
my-asg
输出:
{ "NotificationConfigurations": [ { "AutoScalingGroupName": "my-asg", "NotificationType": "autoscaling:TEST_NOTIFICATION", "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic-2" }, { "AutoScalingGroupName": "my-asg", "NotificationType": "autoscaling:TEST_NOTIFICATION", "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic" } ] }
有关更多信息,请参阅 Amazon Auto Scaling 用户指南中的在您的 Auto Scaling 群组扩展时获取 Amazon EC2 SNS 通知。
示例 1:描述指定数量的通知配置
要返回特定数量的通知配置,请使用
max-items
参数。aws autoscaling describe-notification-configurations \ --auto-scaling-group-name
my-auto-scaling-group
\ --max-items1
输出:
{ "NotificationConfigurations": [ { "AutoScalingGroupName": "my-asg", "NotificationType": "autoscaling:TEST_NOTIFICATION", "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic-2" }, { "AutoScalingGroupName": "my-asg", "NotificationType": "autoscaling:TEST_NOTIFICATION", "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic" } ] }
如果输出包含
NextToken
字段,可返回更多通知配置。要获取其他通知配置,请在后续调用中使用此字段的值和starting-token
选项,如下所示。aws autoscaling describe-notification-configurations \ --auto-scaling-group-name
my-asg
\ --starting-tokenZ3M3LMPEXAMPLE
有关更多信息,请参阅 Amazon Auto Scaling 用户指南中的在您的 Auto Scaling 群组扩展时获取 Amazon EC2 SNS 通知。
-
有关 API 的详细信息,请参阅AWS CLI 命令参考DescribeNotificationConfigurations
中的。
-