Table of Contents

Class PutBucketNotificationRequest

Namespace
Amazon.S3.Model
Assembly
AWSSDK.S3.dll

Container for the parameters to the PutBucketNotification operation. Enables notifications of specified events for a bucket. For more information about event notifications, see Configuring Event Notifications.

Using this API, you can replace an existing notification configuration. The configuration is an XML file that defines the event types that you want Amazon S3 to publish and the destination where you want Amazon S3 to publish an event notification when it detects an event of the specified type.

By default, your bucket has no event notifications configured. That is, the notification configuration will be an empty

NotificationConfiguration
.

<NotificationConfiguration>

</NotificationConfiguration>

This action replaces the existing notification configuration with the configuration you include in the request body.

After Amazon S3 receives this request, it first verifies that any Amazon Simple Notification Service (Amazon SNS) or Amazon Simple Queue Service (Amazon SQS) destination exists, and that the bucket owner has permission to publish to it by sending a test notification. In the case of Lambda destinations, Amazon S3 verifies that the Lambda function permissions grant Amazon S3 permission to invoke the function from the Amazon S3 bucket. For more information, see Configuring Notifications for Amazon S3 Events.

You can disable notifications by adding the empty NotificationConfiguration element.

By default, only the bucket owner can configure notifications on a bucket. However, bucket owners can use a bucket policy to grant permission to other users to set this configuration with

s3:PutBucketNotification
permission.
note

The PUT notification is an atomic operation. For example, suppose your notification configuration includes SNS topic, SQS queue, and Lambda function configurations. When you send a PUT request with this configuration, Amazon S3 sends test messages to your SNS topic. If the message fails, the entire PUT action will fail, and Amazon S3 will not add the configuration to your bucket.

Responses

If the configuration in the request body includes only one

TopicConfiguration
specifying only the
s3:ReducedRedundancyLostObject
event type, the response will also include the
x-amz-sns-test-message-id
header containing the message ID of the test notification sent to the topic.

The following action is related to

PutBucketNotificationConfiguration
:
public class PutBucketNotificationRequest : AmazonWebServiceRequest
Inheritance
PutBucketNotificationRequest

Constructors

PutBucketNotificationRequest()

public PutBucketNotificationRequest()

Properties

BucketName

Gets and sets the BucketName property.

public string BucketName { get; set; }

Property Value

string

ChecksumAlgorithm

Gets and sets the property ChecksumAlgorithm.

public ChecksumAlgorithm ChecksumAlgorithm { get; set; }

Property Value

ChecksumAlgorithm

EventBridgeConfiguration

Gets and sets the property EventBridgeConfiguration.

Enables delivery of all bucket events to Amazon EventBridge.

public EventBridgeConfiguration EventBridgeConfiguration { get; set; }

Property Value

EventBridgeConfiguration

ExpectedBucketOwner

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

public string ExpectedBucketOwner { get; set; }

Property Value

string

LambdaFunctionConfigurations

Gets and sets the LambdaFunctionConfigurations property. LambdaFunctionConfigurations are configuration for Amazon S3 events to be sent to an Amazon Lambda cloud function.

public List<LambdaFunctionConfiguration> LambdaFunctionConfigurations { get; set; }

Property Value

List<LambdaFunctionConfiguration>

QueueConfigurations

Gets and sets the QueueConfigurations property. QueueConfigurations are configuration for Amazon S3 events to be sent to Amazon SQS queues.

public List<QueueConfiguration> QueueConfigurations { get; set; }

Property Value

List<QueueConfiguration>

SkipDestinationValidation

Gets and sets the property SkipDestinationValidation.

Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations

public bool SkipDestinationValidation { get; set; }

Property Value

bool

TopicConfigurations

Gets and sets the TopicConfigurations property. TopicConfigurations are configuration for Amazon S3 events to be sent to Amazon SNS topics.

public List<TopicConfiguration> TopicConfigurations { get; set; }

Property Value

List<TopicConfiguration>