get_bucket_notification_configuration

S3.Client.get_bucket_notification_configuration(**kwargs)

Returns the notification configuration of a bucket.

If notifications are not enabled on the bucket, the action returns an empty NotificationConfiguration element.

By default, you must be the bucket owner to read the notification configuration of a bucket. However, the bucket owner can use a bucket policy to grant permission to other users to read this configuration with the s3:GetBucketNotification permission.

For more information about setting and reading the notification configuration on a bucket, see Setting Up Notification of Bucket Events. For more information about bucket policies, see Using Bucket Policies.

The following action is related to GetBucketNotification :

See also: AWS API Documentation

Request Syntax

response = client.get_bucket_notification_configuration(
    Bucket='string',
    ExpectedBucketOwner='string'
)
Parameters
  • Bucket (string) --

    [REQUIRED]

    The name of the bucket for which to get the notification configuration.

  • ExpectedBucketOwner (string) -- The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden (access denied).
Return type

dict

Returns

Response Syntax

{
    'TopicConfigurations': [
        {
            'Id': 'string',
            'TopicArn': 'string',
            'Events': [
                's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:*'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed'|'s3:Replication:*'|'s3:Replication:OperationFailedReplication'|'s3:Replication:OperationNotTracked'|'s3:Replication:OperationMissedThreshold'|'s3:Replication:OperationReplicatedAfterThreshold'|'s3:ObjectRestore:Delete'|'s3:LifecycleTransition'|'s3:IntelligentTiering'|'s3:ObjectAcl:Put'|'s3:LifecycleExpiration:*'|'s3:LifecycleExpiration:Delete'|'s3:LifecycleExpiration:DeleteMarkerCreated'|'s3:ObjectTagging:*'|'s3:ObjectTagging:Put'|'s3:ObjectTagging:Delete',
            ],
            'Filter': {
                'Key': {
                    'FilterRules': [
                        {
                            'Name': 'prefix'|'suffix',
                            'Value': 'string'
                        },
                    ]
                }
            }
        },
    ],
    'QueueConfigurations': [
        {
            'Id': 'string',
            'QueueArn': 'string',
            'Events': [
                's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:*'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed'|'s3:Replication:*'|'s3:Replication:OperationFailedReplication'|'s3:Replication:OperationNotTracked'|'s3:Replication:OperationMissedThreshold'|'s3:Replication:OperationReplicatedAfterThreshold'|'s3:ObjectRestore:Delete'|'s3:LifecycleTransition'|'s3:IntelligentTiering'|'s3:ObjectAcl:Put'|'s3:LifecycleExpiration:*'|'s3:LifecycleExpiration:Delete'|'s3:LifecycleExpiration:DeleteMarkerCreated'|'s3:ObjectTagging:*'|'s3:ObjectTagging:Put'|'s3:ObjectTagging:Delete',
            ],
            'Filter': {
                'Key': {
                    'FilterRules': [
                        {
                            'Name': 'prefix'|'suffix',
                            'Value': 'string'
                        },
                    ]
                }
            }
        },
    ],
    'LambdaFunctionConfigurations': [
        {
            'Id': 'string',
            'LambdaFunctionArn': 'string',
            'Events': [
                's3:ReducedRedundancyLostObject'|'s3:ObjectCreated:*'|'s3:ObjectCreated:Put'|'s3:ObjectCreated:Post'|'s3:ObjectCreated:Copy'|'s3:ObjectCreated:CompleteMultipartUpload'|'s3:ObjectRemoved:*'|'s3:ObjectRemoved:Delete'|'s3:ObjectRemoved:DeleteMarkerCreated'|'s3:ObjectRestore:*'|'s3:ObjectRestore:Post'|'s3:ObjectRestore:Completed'|'s3:Replication:*'|'s3:Replication:OperationFailedReplication'|'s3:Replication:OperationNotTracked'|'s3:Replication:OperationMissedThreshold'|'s3:Replication:OperationReplicatedAfterThreshold'|'s3:ObjectRestore:Delete'|'s3:LifecycleTransition'|'s3:IntelligentTiering'|'s3:ObjectAcl:Put'|'s3:LifecycleExpiration:*'|'s3:LifecycleExpiration:Delete'|'s3:LifecycleExpiration:DeleteMarkerCreated'|'s3:ObjectTagging:*'|'s3:ObjectTagging:Put'|'s3:ObjectTagging:Delete',
            ],
            'Filter': {
                'Key': {
                    'FilterRules': [
                        {
                            'Name': 'prefix'|'suffix',
                            'Value': 'string'
                        },
                    ]
                }
            }
        },
    ],
    'EventBridgeConfiguration': {}
}

Response Structure

  • (dict) --

    A container for specifying the notification configuration of the bucket. If this element is empty, notifications are turned off for the bucket.

    • TopicConfigurations (list) --

      The topic to which notifications are sent and the events for which notifications are generated.

      • (dict) --

        A container for specifying the configuration for publication of messages to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 detects specified events.

        • Id (string) --

          An optional unique identifier for configurations in a notification configuration. If you don't provide one, Amazon S3 will assign an ID.

        • TopicArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 publishes a message when it detects events of the specified type.

        • Events (list) --

          The Amazon S3 bucket event about which to send notifications. For more information, see Supported Event Types in the Amazon S3 User Guide .

          • (string) --

            The bucket event for which to send notifications.

        • Filter (dict) --

          Specifies object key name filtering rules. For information about key name filtering, see Configuring Event Notifications in the Amazon S3 User Guide .

          • Key (dict) --

            A container for object key name prefix and suffix filtering rules.

            • FilterRules (list) --

              A list of containers for the key-value pair that defines the criteria for the filter rule.

              • (dict) --

                Specifies the Amazon S3 object key name to filter on and whether to filter on the suffix or prefix of the key name.

                • Name (string) --

                  The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide .

                • Value (string) --

                  The value that the filter searches for in object key names.

    • QueueConfigurations (list) --

      The Amazon Simple Queue Service queues to publish messages to and the events for which to publish messages.

      • (dict) --

        Specifies the configuration for publishing messages to an Amazon Simple Queue Service (Amazon SQS) queue when Amazon S3 detects specified events.

        • Id (string) --

          An optional unique identifier for configurations in a notification configuration. If you don't provide one, Amazon S3 will assign an ID.

        • QueueArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 publishes a message when it detects events of the specified type.

        • Events (list) --

          A collection of bucket events for which to send notifications

          • (string) --

            The bucket event for which to send notifications.

        • Filter (dict) --

          Specifies object key name filtering rules. For information about key name filtering, see Configuring Event Notifications in the Amazon S3 User Guide .

          • Key (dict) --

            A container for object key name prefix and suffix filtering rules.

            • FilterRules (list) --

              A list of containers for the key-value pair that defines the criteria for the filter rule.

              • (dict) --

                Specifies the Amazon S3 object key name to filter on and whether to filter on the suffix or prefix of the key name.

                • Name (string) --

                  The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide .

                • Value (string) --

                  The value that the filter searches for in object key names.

    • LambdaFunctionConfigurations (list) --

      Describes the Lambda functions to invoke and the events for which to invoke them.

      • (dict) --

        A container for specifying the configuration for Lambda notifications.

        • Id (string) --

          An optional unique identifier for configurations in a notification configuration. If you don't provide one, Amazon S3 will assign an ID.

        • LambdaFunctionArn (string) --

          The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs.

        • Events (list) --

          The Amazon S3 bucket event for which to invoke the Lambda function. For more information, see Supported Event Types in the Amazon S3 User Guide .

          • (string) --

            The bucket event for which to send notifications.

        • Filter (dict) --

          Specifies object key name filtering rules. For information about key name filtering, see Configuring Event Notifications in the Amazon S3 User Guide .

          • Key (dict) --

            A container for object key name prefix and suffix filtering rules.

            • FilterRules (list) --

              A list of containers for the key-value pair that defines the criteria for the filter rule.

              • (dict) --

                Specifies the Amazon S3 object key name to filter on and whether to filter on the suffix or prefix of the key name.

                • Name (string) --

                  The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide .

                • Value (string) --

                  The value that the filter searches for in object key names.

    • EventBridgeConfiguration (dict) --

      Enables delivery of events to Amazon EventBridge.