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

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

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

与 AWS SDK或GetBucketNotification一起使用 CLI

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

CLI
AWS CLI

以下命令检索名为 my-bucket 的存储桶的通知配置:

aws s3api get-bucket-notification --bucket my-bucket

输出:

{ "TopicConfiguration": { "Topic": "arn:aws:sns:us-west-2:123456789012:my-notification-topic", "Id": "YmQzMmEwM2EjZWVlI0NGItNzVtZjI1MC00ZjgyLWZDBiZWNl", "Event": "s3:ObjectCreated:*", "Events": [ "s3:ObjectCreated:*" ] } }
PowerShell
用于 PowerShell

示例 1:此示例检索给定存储桶的通知配置

Get-S3BucketNotification -BucketName amzn-s3-demo-bucket | select -ExpandProperty TopicConfigurations

输出:

Id Topic -- ----- mimo arn:aws:sns:eu-west-1:123456789012:topic-1