

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 搭配使用 `DescribeNotificationConfigurations` 與 CLI
<a name="example_auto-scaling_DescribeNotificationConfigurations_section"></a>

下列程式碼範例示範如何使用 `DescribeNotificationConfigurations`。

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

**AWS CLI**  
**範例 1：描述指定群組的通知組態**  
此範例描述指定的 Auto Scaling 群組的通知組態。  

```
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 使用者指南*中的[取得 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 使用者指南*中的[取得 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 ]

**Tools for PowerShell V4**  
**範例 1：此範例描述與指定的 Auto Scaling 群組相關聯的通知動作。**  

```
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：此範例描述與所有 Auto Scaling 群組相關聯的通知動作。**  

```
Get-ASNotificationConfiguration
```
+  如需 API 詳細資訊，請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》**中的 [DescribeNotificationConfigurations](https://docs.aws.amazon.com/powershell/v4/reference)。

**Tools for PowerShell V5**  
**範例 1：此範例描述與指定的 Auto Scaling 群組相關聯的通知動作。**  

```
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：此範例描述與所有 Auto Scaling 群組相關聯的通知動作。**  

```
Get-ASNotificationConfiguration
```
+  如需 API 詳細資訊，請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》**中的 [DescribeNotificationConfigurations](https://docs.aws.amazon.com/powershell/v5/reference)。

------

如需 AWS SDK 開發人員指南和程式碼範例的完整清單，請參閱 [搭配 AWS SDK 使用此服務](sdk-general-information-section.md)。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。