本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
啟用 Amazon EventBridge
您可以使用 S3 主控台、 AWS Command Line Interface (AWS CLI) 或 Amazon S3 REST API 啟用 Amazon EventBridge。
注意
啟用 EventBridge 之後,變更生效需時約五分鐘。
啟用 S3 主控台中的 EventBridge 事件傳遞。
登入 AWS Management Console 並開啟位於 https://https://console.aws.amazon.com/s3/
的 Amazon S3 主控台。 -
在左側導覽窗格中,選擇一般用途儲存貯體。
-
在儲存貯體清單中,選擇您要啟用事件的儲存貯體名稱。
-
選擇 Properties (屬性)。
-
導覽至 Event Notifications (事件通知) 區段,然後尋找 Amazon EventBridge 子區段。選擇編輯。
-
在 Send notifications to Amazon EventBridge for all events in this bucket (將此儲存貯體中所有事件的通知傳送至 Amazon 事件 Bridge) 下,選擇 On (開啟)。
下列範例會為已啟用 Amazon EventBridge 的儲存貯體 amzn-s3-demo-bucket1
建立儲存貯體通知組態。
aws s3api put-bucket-notification-configuration --bucket
amzn-s3-demo-bucket1
--notification-configuration='{ "EventBridgeConfiguration": {} }'
您可以呼叫 Amazon S3 REST API,以程式設計方式啟用儲存貯體上的 Amazon EventBridge。如需詳細資訊,請參閱《Amazon Simple Storage Service API 參考》中的 PutBucketNotificationConfiguration。
下列範例顯示用於建立已啟用 Amazon EventBridge 之儲存貯體通知組態的 XML。
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <EventBridgeConfiguration> </EventBridgeConfiguration> </NotificationConfiguration>
建立 EventBridge 規則
啟用後,您可以為某些任務建立 Amazon EventBridge 規則。例如,您可以在建立物件時傳送電子郵件通知。如需完整的教學課程,請參閱《Amazon EventBridge 使用者指南》中的教學課程:建立 Amazon S3 物件時傳送通知。