Gunakan GetBucketNotification dengan AWS SDK atau CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan GetBucketNotification dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanGetBucketNotification.

CLI
AWS CLI

Perintah berikut mengambil konfigurasi notifikasi untuk bucket bernamamy-bucket:

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

Output:

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

Contoh 1: Contoh ini mengambil konfigurasi notifikasi dari bucket yang diberikan

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

Output:

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