Search code examples
python-3.xamazon-web-servicesamazon-s3boto3aws-event-bridge

How do I check the EventBridge notification settings for an S3 bucket?


I have an S3 bucket with the Amazon EventBridge setting turned on for "Send notifications to Amazon EventBridge for all events in this bucket". I don't get a response trying to use the boto3 S3 client when trying to confirm it has been enabled, though.

client = boto3.client("s3")
client.get_bucket_notification_configuration(Bucket=bucket_name)

I have enabled the setting through the following Terraform, if that helps show where the configuration may be set.

resource "aws_s3_bucket_notification" "s3_bucket_eventbridge" {
  bucket      = var.bucket_name
  eventbridge = true
}

Is there a different client method to use to verify this notification setting?


Solution

  • If the EventBridge events are enabled, you should get a non-empty value for EventBridgeConfiguration in the response for get_bucket_notification_configuration. If it is non-empty, then your events are enabled.

    But the documentation says you must be an owner or have GetBucketNotification permissions for that bucket in order for the call to work.