Amazon Simple Storage Service

2026/11/29 - Amazon Simple Storage Service - 3 new 4 updated api methods

Changes  Added S3 API GetPart allowing users to retrieve individual parts of in-progress and complete multipart uploads. Also introduced bucket default storage classes for users to change bucket default to intelligent tiering, and apply to all new objects stored in the bucket.

GetBucketDefaultStorageClass (new) Link ¶

Returns the default storage class of the general purpose bucket. Amazon S3 uses the default storage class for new objects that you write to the bucket without the x-amz-storage-class request header. If you haven't set a default storage class for the bucket, Amazon S3 returns STANDARD. For more information, see Setting the default storage class for a bucket in the Amazon S3 User Guide.

To use this operation, you must have the s3:GetBucketDefaultStorageClass permission.

The following operations are related to GetBucketDefaultStorageClass:

See also: AWS API Documentation

Request Syntax

client.get_bucket_default_storage_class(
    Bucket='string',
    ExpectedBucketOwner='string'
)
type Bucket:

string

param Bucket:

[REQUIRED]

The name of the general purpose bucket.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The Amazon Web Services account ID of the general purpose bucket's owner.

rtype:

dict

returns:

Response Syntax

{
    'DefaultStorageClassConfiguration': {
        'DefaultStorageClass': 'STANDARD'|'INTELLIGENT_TIERING'
    }
}

Response Structure

  • (dict) --

    • DefaultStorageClassConfiguration (dict) --

      The configuration that specifies the default storage class of the general purpose bucket.

      • DefaultStorageClass (string) --

        The default storage class of the general purpose bucket. Valid values are STANDARD and INTELLIGENT_TIERING.

GetPart (new) Link ¶

Retrieves a single part of an in-progress or completed multipart upload.

Before retrieving any part corresponding to an upload ID, a multipart upload must be initiated (see CreateMultipartUpload). In response to the initiate request, S3 returns an upload ID, a unique identifier that must be included in the GetPart request.

Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being created.

The GetPart request must specify the full key name for the object. To retrieve a specific range of bytes from a part, use the Range header to specify the byte range (for example, bytes=0-9).

Both the virtual-hosted-style requests and the path-style requests are supported. For a virtual hosted-style request example, the object photos/2006/February/sample.jpg is specified as /photos/2006/February/sample.jpg. For a path-style request example, the object photos/2006/February/sample.jpg in the bucket named examplebucket is specified as /examplebucket/photos/2006/February/sample.jpg. For more information about request types, see HTTP Host Header Bucket Specification in the Amazon S3 User Guide.

Permissions

General purpose bucket permissions - The s3:GetObject permission is required to use GetPart for unversioned objects or uploads. For versioned objects or uploads, the s3:GetObjectVersion permission is required instead. For all requests to in-progress multipart uploads, the s3:GetIncompleteUpload permission is also required. For more information, see Specifying permissions in a policy in the Amazon S3 User Guide.

Storage classes

For completed multipart uploads, GetPart does not support retrieving a part from an object that is stored in the S3 Glacier Flexible Retrieval storage class, the S3 Glacier Deep Archive storage class, or the S3 Intelligent-Tiering storage class. Such requests will return an InvalidObjectState error. Restoring is not supported for GetPart. For more information about storage classes, see Using Amazon S3 storage classes in the Amazon S3 User Guide.

Encryption

Encryption request headers, like x-amz-server-side-encryption, should not be sent for the GetPart requests, if your object uses server-side encryption with Amazon S3 managed encryption keys (SSE-S3), server-side encryption with Key Management Service (KMS) keys (SSE-KMS), or dual-layer server-side encryption with Amazon Web Services KMS keys (DSSE-KMS). If you include the header in your GetPart requests for the object that uses these types of keys, you’ll get an HTTP 400 Bad Request error.

Server-side encryption with customer-provided keys (SSE-C) is not supported for GetPart.

The following operations are related to GetPart:

See also: AWS API Documentation

Request Syntax

client.get_part(
    Bucket='string',
    Key='string',
    Range='string',
    RequestPayer='requester',
    UploadId='string',
    PartNumber=123,
    ExpectedBucketOwner='string',
    ChecksumMode='ENABLED'
)
type Bucket:

string

param Bucket:

[REQUIRED]

The name of the bucket containing the part to retrieve.

type Key:

string

param Key:

[REQUIRED]

Object key for which the multipart upload was initiated.

type Range:

string

param Range:

Downloads the specified byte range of a part. For more information about the HTTP Range header, see https://www.rfc-editor.org/rfc/rfc9110.html#name-range.

type RequestPayer:

string

param RequestPayer:

Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.

type UploadId:

string

param UploadId:

[REQUIRED]

Upload ID identifying the multipart upload to retrieve the specified part from.

type PartNumber:

integer

param PartNumber:

[REQUIRED]

Part number of the part to retrieve. This is a positive integer between 1 and 10,000.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

type ChecksumMode:

string

param ChecksumMode:

To retrieve the checksum, this mode must be enabled.

rtype:

dict

returns:

Response Syntax

{
    'Body': StreamingBody(),
    'AcceptRanges': 'string',
    'ContentLength': 123,
    'ETag': 'string',
    'MultipartUploadStatus': 'IN_PROGRESS'|'COMPLETED',
    'ChecksumCRC32': 'string',
    'ChecksumCRC32C': 'string',
    'ChecksumCRC64NVME': 'string',
    'ChecksumSHA1': 'string',
    'ChecksumSHA256': 'string',
    'ChecksumSHA512': 'string',
    'ChecksumMD5': 'string',
    'ChecksumXXHASH64': 'string',
    'ChecksumXXHASH3': 'string',
    'ChecksumXXHASH128': 'string',
    'VersionId': 'string',
    'ContentRange': 'string',
    'ServerSideEncryption': 'AES256'|'aws:fsx'|'aws:backup'|'aws:kms'|'aws:kms:dsse',
    'SSEKMSKeyId': 'string',
    'BucketKeyEnabled': True|False,
    'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE'|'OUTPOSTS'|'GLACIER_IR'|'SNOW'|'EXPRESS_ONEZONE'|'FSX_OPENZFS'|'FSX_ONTAP'|'AWS_BACKUP_WARM'|'AWS_BACKUP_LOW_COST_WARM',
    'RequestCharged': 'requester'
}

Response Structure

  • (dict) --

    • Body (:class:`.StreamingBody`) --

      Part data.

    • AcceptRanges (string) --

      Indicates that a range of bytes was specified in the request.

    • ContentLength (integer) --

      The size of the retrieved part in bytes.

    • ETag (string) --

      The entity tag of the part.

    • MultipartUploadStatus (string) --

      The status of the multipart upload. Possible values are:

      • IN_PROGRESS - CompleteMultipartUpload has not been called. The part data exists, and can be overwritten by a subsequent UploadPart call with the same part number.

      • COMPLETED - CompleteMultipartUpload has been called. The part data is immutable, and the full object exists.

    • ChecksumCRC32 (string) --

      The Base64 encoded, 32-bit CRC32 checksum of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumCRC32C (string) --

      The Base64 encoded, 32-bit CRC32C checksum of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumCRC64NVME (string) --

      The Base64 encoded, 64-bit CRC64NVME checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumSHA1 (string) --

      The Base64 encoded, 160-bit SHA1 digest of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumSHA256 (string) --

      The Base64 encoded, 256-bit SHA256 digest of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumSHA512 (string) --

      The Base64 encoded, 512-bit SHA512 digest of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumMD5 (string) --

      The Base64 encoded, 128-bit MD5 digest of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumXXHASH64 (string) --

      The Base64 encoded, 64-bit XXHASH64 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumXXHASH3 (string) --

      The Base64 encoded, 64-bit XXHASH3 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • ChecksumXXHASH128 (string) --

      The Base64 encoded, 128-bit XXHASH128 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • VersionId (string) --

      Version ID of the object.

    • ContentRange (string) --

      The portion of the part that was returned in the response.

    • ServerSideEncryption (string) --

      The server-side encryption algorithm used when storing this multipart upload in Amazon S3.

    • SSEKMSKeyId (string) --

      If present, indicates the ID of the KMS key that was used for object encryption.

    • BucketKeyEnabled (boolean) --

      Indicates whether the multipart upload uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS).

    • StorageClass (string) --

      Provides storage class information about where this part is stored.

      For in-progress multipart uploads, this header can return any of the valid values listed for this header.

    • RequestCharged (string) --

      If present, indicates that the requester was successfully charged for the request. For more information, see Using Requester Pays buckets for storage transfers and usage in the Amazon Simple Storage Service user guide.

PutBucketDefaultStorageClass (new) Link ¶

Sets the default storage class of the general purpose bucket. Amazon S3 uses the default storage class for new objects that you write to the bucket without the x-amz-storage-class request header. A storage class that you specify on the write request takes precedence over the bucket default. For more information, see Setting the default storage class for a bucket in the Amazon S3 User Guide.

Changing the default storage class applies only to objects that you write after you change it. Amazon S3 doesn't change the storage class of objects that are already in the bucket. There is no operation to delete the default storage class. To revert the bucket to its original default, set the storage class to STANDARD.

To use this operation, you must have the s3:PutBucketDefaultStorageClass permission.

The following operations are related to PutBucketDefaultStorageClass:

See also: AWS API Documentation

Request Syntax

client.put_bucket_default_storage_class(
    Bucket='string',
    ContentMD5='string',
    ChecksumAlgorithm='CRC32'|'CRC32C'|'SHA1'|'SHA256'|'CRC64NVME'|'SHA512'|'MD5'|'XXHASH64'|'XXHASH3'|'XXHASH128',
    ExpectedBucketOwner='string',
    DefaultStorageClassConfiguration={
        'DefaultStorageClass': 'STANDARD'|'INTELLIGENT_TIERING'
    }
)
type Bucket:

string

param Bucket:

[REQUIRED]

The name of the general purpose bucket.

type ContentMD5:

string

param ContentMD5:

The MD5 hash of the PutBucketDefaultStorageClass request body.

For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

type ChecksumAlgorithm:

string

param ChecksumAlgorithm:

Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The Amazon Web Services account ID of the general purpose bucket's owner.

type DefaultStorageClassConfiguration:

dict

param DefaultStorageClassConfiguration:

[REQUIRED]

The configuration that specifies the default storage class of the general purpose bucket.

  • DefaultStorageClass (string) -- [REQUIRED]

    The default storage class of the general purpose bucket. Valid values are STANDARD and INTELLIGENT_TIERING.

returns:

None

GetBucketNotification (updated) Link ¶
Changes (response)
{'CloudFunctionConfiguration': {'Event': {'s3:MultipartUpload:*',
                                          's3:MultipartUpload:Aborted',
                                          's3:MultipartUpload:PartCopied',
                                          's3:MultipartUpload:PartUploaded'},
                                'Events': {'s3:MultipartUpload:*',
                                           's3:MultipartUpload:Aborted',
                                           's3:MultipartUpload:PartCopied',
                                           's3:MultipartUpload:PartUploaded'}},
 'QueueConfiguration': {'Event': {'s3:MultipartUpload:*',
                                  's3:MultipartUpload:Aborted',
                                  's3:MultipartUpload:PartCopied',
                                  's3:MultipartUpload:PartUploaded'},
                        'Events': {'s3:MultipartUpload:*',
                                   's3:MultipartUpload:Aborted',
                                   's3:MultipartUpload:PartCopied',
                                   's3:MultipartUpload:PartUploaded'}},
 'TopicConfiguration': {'Event': {'s3:MultipartUpload:*',
                                  's3:MultipartUpload:Aborted',
                                  's3:MultipartUpload:PartCopied',
                                  's3:MultipartUpload:PartUploaded'},
                        'Events': {'s3:MultipartUpload:*',
                                   's3:MultipartUpload:Aborted',
                                   's3:MultipartUpload:PartCopied',
                                   's3:MultipartUpload:PartUploaded'}}}

No longer used, see GetBucketNotificationConfiguration.

See also: AWS API Documentation

Request Syntax

client.get_bucket_notification(
    Bucket='string',
    ExpectedBucketOwner='string'
)
type Bucket:

string

param Bucket:

[REQUIRED]

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

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

rtype:

dict

returns:

Response Syntax

{
    'TopicConfiguration': {
        'Id': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        ],
        'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        'Topic': 'string'
    },
    'QueueConfiguration': {
        'Id': 'string',
        'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        ],
        'Queue': 'string'
    },
    'CloudFunctionConfiguration': {
        'Id': 'string',
        'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
        ],
        'CloudFunction': 'string',
        'InvocationRole': 'string'
    }
}

Response Structure

  • (dict) --

    • TopicConfiguration (dict) --

      This data type is deprecated. 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.

      • Events (list) --

        A collection of events related to objects

        • (string) --

          The bucket event for which to send notifications.

      • Event (string) --

        Bucket event for which to send notifications.

      • Topic (string) --

        Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

    • QueueConfiguration (dict) --

      This data type is deprecated. This data type 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.

      • Event (string) --

        The bucket event for which to send notifications.

      • Events (list) --

        A collection of bucket events for which to send notifications.

        • (string) --

          The bucket event for which to send notifications.

      • Queue (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.

    • CloudFunctionConfiguration (dict) --

      Container for specifying the Lambda notification configuration.

      • Id (string) --

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

      • Event (string) --

        The bucket event for which to send notifications.

      • Events (list) --

        Bucket events for which to send notifications.

        • (string) --

          The bucket event for which to send notifications.

      • CloudFunction (string) --

        Lambda cloud function ARN that Amazon S3 can invoke when it detects events of the specified type.

      • InvocationRole (string) --

        The role supporting the invocation of the Lambda function

GetBucketNotificationConfiguration (updated) Link ¶
Changes (response)
{'LambdaFunctionConfigurations': {'Events': {'s3:MultipartUpload:*',
                                             's3:MultipartUpload:Aborted',
                                             's3:MultipartUpload:PartCopied',
                                             's3:MultipartUpload:PartUploaded'}},
 'QueueConfigurations': {'Events': {'s3:MultipartUpload:*',
                                    's3:MultipartUpload:Aborted',
                                    's3:MultipartUpload:PartCopied',
                                    's3:MultipartUpload:PartUploaded'}},
 'TopicConfigurations': {'Events': {'s3:MultipartUpload:*',
                                    's3:MultipartUpload:Aborted',
                                    's3:MultipartUpload:PartCopied',
                                    's3:MultipartUpload:PartUploaded'}}}

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.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

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

client.get_bucket_notification_configuration(
    Bucket='string',
    ExpectedBucketOwner='string'
)
type Bucket:

string

param Bucket:

[REQUIRED]

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

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

rtype:

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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            '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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

                • 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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

                • 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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

                • 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.

PutBucketNotification (updated) Link ¶
Changes (request)
{'NotificationConfiguration': {'CloudFunctionConfiguration': {'Event': {'s3:MultipartUpload:*',
                                                                        's3:MultipartUpload:Aborted',
                                                                        's3:MultipartUpload:PartCopied',
                                                                        's3:MultipartUpload:PartUploaded'},
                                                              'Events': {'s3:MultipartUpload:*',
                                                                         's3:MultipartUpload:Aborted',
                                                                         's3:MultipartUpload:PartCopied',
                                                                         's3:MultipartUpload:PartUploaded'}},
                               'QueueConfiguration': {'Event': {'s3:MultipartUpload:*',
                                                                's3:MultipartUpload:Aborted',
                                                                's3:MultipartUpload:PartCopied',
                                                                's3:MultipartUpload:PartUploaded'},
                                                      'Events': {'s3:MultipartUpload:*',
                                                                 's3:MultipartUpload:Aborted',
                                                                 's3:MultipartUpload:PartCopied',
                                                                 's3:MultipartUpload:PartUploaded'}},
                               'TopicConfiguration': {'Event': {'s3:MultipartUpload:*',
                                                                's3:MultipartUpload:Aborted',
                                                                's3:MultipartUpload:PartCopied',
                                                                's3:MultipartUpload:PartUploaded'},
                                                      'Events': {'s3:MultipartUpload:*',
                                                                 's3:MultipartUpload:Aborted',
                                                                 's3:MultipartUpload:PartCopied',
                                                                 's3:MultipartUpload:PartUploaded'}}}}

No longer used, see the PutBucketNotificationConfiguration operation.

See also: AWS API Documentation

Request Syntax

client.put_bucket_notification(
    Bucket='string',
    ContentMD5='string',
    ChecksumAlgorithm='CRC32'|'CRC32C'|'SHA1'|'SHA256'|'CRC64NVME'|'SHA512'|'MD5'|'XXHASH64'|'XXHASH3'|'XXHASH128',
    NotificationConfiguration={
        'TopicConfiguration': {
            'Id': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            'Topic': 'string'
        },
        'QueueConfiguration': {
            'Id': 'string',
            'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            'Queue': 'string'
        },
        'CloudFunctionConfiguration': {
            'Id': 'string',
            'Event': '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
            ],
            'CloudFunction': 'string',
            'InvocationRole': 'string'
        }
    },
    ExpectedBucketOwner='string'
)
type Bucket:

string

param Bucket:

[REQUIRED]

The name of the bucket.

type ContentMD5:

string

param ContentMD5:

The MD5 hash of the PutPublicAccessBlock request body.

For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

type ChecksumAlgorithm:

string

param ChecksumAlgorithm:

Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding x-amz-checksum or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad Request. For more information, see Checking object integrity in the Amazon S3 User Guide.

If you provide an individual checksum, Amazon S3 ignores any provided ChecksumAlgorithm parameter.

type NotificationConfiguration:

dict

param NotificationConfiguration:

[REQUIRED]

The container for the configuration.

  • TopicConfiguration (dict) --

    This data type is deprecated. 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.

    • Events (list) --

      A collection of events related to objects

      • (string) --

        The bucket event for which to send notifications.

    • Event (string) --

      Bucket event for which to send notifications.

    • Topic (string) --

      Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

  • QueueConfiguration (dict) --

    This data type is deprecated. This data type 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.

    • Event (string) --

      The bucket event for which to send notifications.

    • Events (list) --

      A collection of bucket events for which to send notifications.

      • (string) --

        The bucket event for which to send notifications.

    • Queue (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.

  • CloudFunctionConfiguration (dict) --

    Container for specifying the Lambda notification configuration.

    • Id (string) --

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

    • Event (string) --

      The bucket event for which to send notifications.

    • Events (list) --

      Bucket events for which to send notifications.

      • (string) --

        The bucket event for which to send notifications.

    • CloudFunction (string) --

      Lambda cloud function ARN that Amazon S3 can invoke when it detects events of the specified type.

    • InvocationRole (string) --

      The role supporting the invocation of the Lambda function

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

returns:

None

PutBucketNotificationConfiguration (updated) Link ¶
Changes (request)
{'NotificationConfiguration': {'LambdaFunctionConfigurations': {'Events': {'s3:MultipartUpload:*',
                                                                           's3:MultipartUpload:Aborted',
                                                                           's3:MultipartUpload:PartCopied',
                                                                           's3:MultipartUpload:PartUploaded'}},
                               'QueueConfigurations': {'Events': {'s3:MultipartUpload:*',
                                                                  's3:MultipartUpload:Aborted',
                                                                  's3:MultipartUpload:PartCopied',
                                                                  's3:MultipartUpload:PartUploaded'}},
                               'TopicConfigurations': {'Events': {'s3:MultipartUpload:*',
                                                                  's3:MultipartUpload:Aborted',
                                                                  's3:MultipartUpload:PartCopied',
                                                                  's3:MultipartUpload:PartUploaded'}}}}

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.

For more information about the number of event notification configurations that you can create per bucket, see Amazon S3 service quotas in Amazon Web Services General Reference.

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 the required s3:PutBucketNotification permission.

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:

See also: AWS API Documentation

Request Syntax

client.put_bucket_notification_configuration(
    Bucket='string',
    NotificationConfiguration={
        '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
                ],
                '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
                ],
                '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'|'s3:ObjectAnnotation:*'|'s3:ObjectAnnotation:Put'|'s3:ObjectAnnotation:Delete'|'s3:ObjectRetention:Put'|'s3:MultipartUpload:*'|'s3:MultipartUpload:PartUploaded'|'s3:MultipartUpload:PartCopied'|'s3:MultipartUpload:Aborted',
                ],
                'Filter': {
                    'Key': {
                        'FilterRules': [
                            {
                                'Name': 'prefix'|'suffix',
                                'Value': 'string'
                            },
                        ]
                    }
                }
            },
        ],
        'EventBridgeConfiguration': {}

    },
    ExpectedBucketOwner='string',
    SkipDestinationValidation=True|False
)
type Bucket:

string

param Bucket:

[REQUIRED]

The name of the bucket.

type NotificationConfiguration:

dict

param NotificationConfiguration:

[REQUIRED]

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) -- [REQUIRED]

        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) -- [REQUIRED]

        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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

              • 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) -- [REQUIRED]

        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) -- [REQUIRED]

        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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

              • 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) -- [REQUIRED]

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

      • Events (list) -- [REQUIRED]

        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 using object key name filtering 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. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/. Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning.

              • 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.

type ExpectedBucketOwner:

string

param ExpectedBucketOwner:

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

type SkipDestinationValidation:

boolean

param SkipDestinationValidation:

Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or false value.

returns:

None