

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

# 将 `DescribeNotificationConfigurations` 与 CLI 配合使用
<a name="example_auto-scaling_DescribeNotificationConfigurations_section"></a>

以下代码示例演示如何使用 `DescribeNotificationConfigurations`。

------
#### [ CLI ]

**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 EC2 Auto Scaling 用户指南》**中的[在自动扩缩组扩展时获取 Amazon SNS 通知](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html)。  
**示例 1：描述指定数量的通知配置**  
要返回特定数量的通知配置，请使用 `max-items` 参数。  

```
aws autoscaling describe-notification-configurations \
    --auto-scaling-group-name my-auto-scaling-group \
    --max-items 1
```
输出：  

```
{
    "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-token Z3M3LMPEXAMPLE
```
有关更多信息，请参阅《Amazon EC2 Auto Scaling 用户指南》**中的[在自动扩缩组扩展时获取 Amazon SNS 通知](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeNotificationConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-notification-configurations.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例描述与指定自动扩缩组关联的通知操作。**  

```
Get-ASNotificationConfiguration -AutoScalingGroupName my-asg | format-list
```
**输出**：  

```
AutoScalingGroupName : my-asg
NotificationType     : auto-scaling:EC2_INSTANCE_LAUNCH
TopicARN             : arn:aws:sns:us-west-2:123456789012:my-topic

AutoScalingGroupName : my-asg
NotificationType     : auto-scaling:EC2_INSTANCE_TERMINATE
TopicARN             : arn:aws:sns:us-west-2:123456789012:my-topic
```
**示例 2：此示例描述与所有自动扩缩组关联的通知操作。**  

```
Get-ASNotificationConfiguration
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [DescribeNotificationConfigurations](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例描述与指定自动扩缩组关联的通知操作。**  

```
Get-ASNotificationConfiguration -AutoScalingGroupName my-asg | format-list
```
**输出**：  

```
AutoScalingGroupName : my-asg
NotificationType     : auto-scaling:EC2_INSTANCE_LAUNCH
TopicARN             : arn:aws:sns:us-west-2:123456789012:my-topic

AutoScalingGroupName : my-asg
NotificationType     : auto-scaling:EC2_INSTANCE_TERMINATE
TopicARN             : arn:aws:sns:us-west-2:123456789012:my-topic
```
**示例 2：此示例描述与所有自动扩缩组关联的通知操作。**  

```
Get-ASNotificationConfiguration
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [DescribeNotificationConfigurations](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------

有关 S AWS DK 开发者指南和代码示例的完整列表，请参阅[将此服务与 AWS SDK 配合使用](sdk-general-information-section.md)。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。