

# CLI で `GetBucketNotification` を使用する
<a name="s3_example_s3_GetBucketNotification_section"></a>

次のサンプルコードは、`GetBucketNotification` を使用する方法を説明しています。

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

**AWS CLI**  
次のコマンドは、`amzn-s3-demo-bucket` という名前のバケットの通知設定を取得します。  

```
aws s3api get-bucket-notification --bucket {{amzn-s3-demo-bucket}}
```
出力:  

```
{
    "TopicConfiguration": {
        "Topic": "arn:aws:sns:us-west-2:123456789012:my-notification-topic",
        "Id": "YmQzMmEwM2EjZWVlI0NGItNzVtZjI1MC00ZjgyLWZDBiZWNl",
        "Event": "s3:ObjectCreated:*",
        "Events": [
            "s3:ObjectCreated:*"
        ]
    }
}
```
+  API の詳細については、「**AWS CLI コマンドリファレンス」の「[GetBucketNotification](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/get-bucket-notification.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: この例では、指定したバケットの通知設定を取得します**  

```
Get-S3BucketNotification -BucketName amzn-s3-demo-bucket | select -ExpandProperty TopicConfigurations
```
**出力:**  

```
Id   Topic
--   -----
mimo arn:aws:sns:eu-west-1:123456789012:topic-1
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[GetBucketNotification](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定したバケットの通知設定を取得します**  

```
Get-S3BucketNotification -BucketName amzn-s3-demo-bucket | select -ExpandProperty TopicConfigurations
```
**出力:**  

```
Id   Topic
--   -----
mimo arn:aws:sns:eu-west-1:123456789012:topic-1
```
+  API の詳細については、AWS Tools for PowerShell コマンドレットリファレンス (V5) の「[GetBucketNotification](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。**

------

AWS SDK デベロッパーガイドとコード例の詳細なリストについては、[AWS SDK を使用した Amazon S3 での開発](sdk-general-information-section.md) を参照してください。このトピックには、使用開始方法に関する情報と、以前の SDK バージョンの詳細も含まれています。