搭配使用 GetBucketNotification 與 CLI - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

搭配使用 GetBucketNotification 與 CLI

下列程式碼範例示範如何使用 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:*" ] } }
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 Cmdlet 參考 (V4)》中的 GetBucketNotification

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 Cmdlet 參考 (V5)》中的 GetBucketNotification