Amazon Simple Storage Service

2019/11/20 - Amazon Simple Storage Service - 6 updated api methods

Changes  This release introduces support for Amazon S3 Replication Time Control, a new feature of S3 Replication that provides a predictable replication time backed by a Service Level Agreement. S3 Replication Time Control helps customers meet compliance or business requirements for data replication, and provides visibility into the replication process with new Amazon CloudWatch Metrics.

GetBucketNotification (updated) Link ¶
Changes (response)
{'CloudFunctionConfiguration': {'Event': ['s3:Replication:*',
                                          's3:ObjectRestore:*',
                                          's3:Replication:OperationMissedThreshold',
                                          's3:Replication:OperationFailedReplication',
                                          's3:Replication:OperationReplicatedAfterThreshold',
                                          's3:Replication:OperationNotTracked'],
                                'Events': ['s3:Replication:*',
                                           's3:ObjectRestore:*',
                                           's3:Replication:OperationMissedThreshold',
                                           's3:Replication:OperationFailedReplication',
                                           's3:Replication:OperationReplicatedAfterThreshold',
                                           's3:Replication:OperationNotTracked']},
 'QueueConfiguration': {'Event': ['s3:Replication:*',
                                  's3:ObjectRestore:*',
                                  's3:Replication:OperationMissedThreshold',
                                  's3:Replication:OperationFailedReplication',
                                  's3:Replication:OperationReplicatedAfterThreshold',
                                  's3:Replication:OperationNotTracked'],
                        'Events': ['s3:Replication:*',
                                   's3:ObjectRestore:*',
                                   's3:Replication:OperationMissedThreshold',
                                   's3:Replication:OperationFailedReplication',
                                   's3:Replication:OperationReplicatedAfterThreshold',
                                   's3:Replication:OperationNotTracked']},
 'TopicConfiguration': {'Event': ['s3:Replication:*',
                                  's3:ObjectRestore:*',
                                  's3:Replication:OperationMissedThreshold',
                                  's3:Replication:OperationFailedReplication',
                                  's3:Replication:OperationReplicatedAfterThreshold',
                                  's3:Replication:OperationNotTracked'],
                        'Events': ['s3:Replication:*',
                                   's3:ObjectRestore:*',
                                   's3:Replication:OperationMissedThreshold',
                                   's3:Replication:OperationFailedReplication',
                                   's3:Replication:OperationReplicatedAfterThreshold',
                                   's3:Replication:OperationNotTracked']}}

No longer used, see GetBucketNotificationConfiguration .

!DANGER!

This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.

See also: AWS API Documentation

Request Syntax

client.get_bucket_notification(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

Name of the bucket for which to get the notification configuration

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',
        ],
        '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',
        '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',
        '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',
        ],
        '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',
        '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',
        ],
        'CloudFunction': 'string',
        'InvocationRole': 'string'
    }
}

Response Structure

  • (dict) --

    • TopicConfiguration (dict) --

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

        • (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 AWS 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:Replication:*',
                                             's3:ObjectRestore:*',
                                             's3:Replication:OperationMissedThreshold',
                                             's3:Replication:OperationFailedReplication',
                                             's3:Replication:OperationReplicatedAfterThreshold',
                                             's3:Replication:OperationNotTracked']},
 'QueueConfigurations': {'Events': ['s3:Replication:*',
                                    's3:ObjectRestore:*',
                                    's3:Replication:OperationMissedThreshold',
                                    's3:Replication:OperationFailedReplication',
                                    's3:Replication:OperationReplicatedAfterThreshold',
                                    's3:Replication:OperationNotTracked']},
 'TopicConfigurations': {'Events': ['s3:Replication:*',
                                    's3:ObjectRestore:*',
                                    's3:Replication:OperationMissedThreshold',
                                    's3:Replication:OperationFailedReplication',
                                    's3:Replication:OperationReplicatedAfterThreshold',
                                    's3:Replication:OperationNotTracked']}}

Returns the notification configuration of a bucket.

If notifications are not enabled on the bucket, the operation 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 operation is related to GetBucketNotification :

  • PutBucketNotification

See also: AWS API Documentation

Request Syntax

client.get_bucket_notification_configuration(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

Name of the bucket for which to get the notification configuration

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',
            ],
            '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',
            ],
            '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',
            ],
            'Filter': {
                'Key': {
                    'FilterRules': [
                        {
                            'Name': 'prefix'|'suffix',
                            'Value': 'string'
                        },
                    ]
                }
            }
        },
    ]
}

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 Simple Storage Service Developer 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 Simple Storage Service Developer 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 Simple Storage Service Developer 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 notiications

          • (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 Simple Storage Service Developer 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 Simple Storage Service Developer Guide .

                • Value (string) --

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

    • LambdaFunctionConfigurations (list) --

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

      • (dict) --

        A container for specifying the configuration for AWS 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 AWS Lambda function that Amazon S3 invokes when the specified event type occurs.

        • Events (list) --

          The Amazon S3 bucket event for which to invoke the AWS Lambda function. For more information, see Supported Event Types in the Amazon Simple Storage Service Developer 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 Simple Storage Service Developer 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 Simple Storage Service Developer Guide .

                • Value (string) --

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

GetBucketReplication (updated) Link ¶
Changes (response)
{'ReplicationConfiguration': {'Rules': {'Destination': {'Metrics': {'EventThreshold': {'Minutes': 'integer'},
                                                                    'Status': 'Enabled '
                                                                              '| '
                                                                              'Disabled'},
                                                        'ReplicationTime': {'Status': 'Enabled '
                                                                                      '| '
                                                                                      'Disabled',
                                                                            'Time': {'Minutes': 'integer'}}}}}}

Returns the replication configuration of a bucket.

Note

It can take a while to propagate the put or delete a replication configuration to all Amazon S3 systems. Therefore, a get request soon after put or delete can return a wrong result.

For information about replication configuration, see Replication .

This operation requires permissions for the s3:GetReplicationConfiguration action. For more information about permissions, see Using Bucket Policies and User Policies .

If you include the Filter element in a replication configuration, you must also include the DeleteMarkerReplication and Priority elements. The response also returns those elements.

GetBucketReplication has the following special error:

  • Error code: NoSuchReplicationConfiguration

    • Description: There is no replication configuration with that name.

    • HTTP Status Code: 404 Not Found

    • SOAP Fault Code Prefix: Client

The following operations are related to GetBucketReplication :

  • PutBucketReplication

  • DeleteBucketReplication

See also: AWS API Documentation

Request Syntax

client.get_bucket_replication(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The bucket name for which to get the replication information.

rtype

dict

returns

Response Syntax

{
    'ReplicationConfiguration': {
        'Role': 'string',
        'Rules': [
            {
                'ID': 'string',
                'Priority': 123,
                'Prefix': 'string',
                'Filter': {
                    'Prefix': 'string',
                    'Tag': {
                        'Key': 'string',
                        'Value': 'string'
                    },
                    'And': {
                        'Prefix': 'string',
                        'Tags': [
                            {
                                'Key': 'string',
                                'Value': 'string'
                            },
                        ]
                    }
                },
                'Status': 'Enabled'|'Disabled',
                'SourceSelectionCriteria': {
                    'SseKmsEncryptedObjects': {
                        'Status': 'Enabled'|'Disabled'
                    }
                },
                'ExistingObjectReplication': {
                    'Status': 'Enabled'|'Disabled'
                },
                'Destination': {
                    'Bucket': 'string',
                    'Account': 'string',
                    'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE',
                    'AccessControlTranslation': {
                        'Owner': 'Destination'
                    },
                    'EncryptionConfiguration': {
                        'ReplicaKmsKeyID': 'string'
                    },
                    'ReplicationTime': {
                        'Status': 'Enabled'|'Disabled',
                        'Time': {
                            'Minutes': 123
                        }
                    },
                    'Metrics': {
                        'Status': 'Enabled'|'Disabled',
                        'EventThreshold': {
                            'Minutes': 123
                        }
                    }
                },
                'DeleteMarkerReplication': {
                    'Status': 'Enabled'|'Disabled'
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ReplicationConfiguration (dict) --

      A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication configuration is 2 MB.

      • Role (string) --

        The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that Amazon S3 assumes when replicating objects. For more information, see How to Set Up Replication in the Amazon Simple Storage Service Developer Guide .

      • Rules (list) --

        A container for one or more replication rules. A replication configuration must have at least one rule and can contain a maximum of 1,000 rules.

        • (dict) --

          Specifies which Amazon S3 objects to replicate and where to store the replicas.

          • ID (string) --

            A unique identifier for the rule. The maximum value is 255 characters.

          • Priority (integer) --

            The priority associated with the rule. If you specify multiple rules in a replication configuration, Amazon S3 prioritizes the rules to prevent conflicts when filtering. If two or more rules identify the same object based on a specified filter, the rule with higher priority takes precedence. For example:

            • Same object quality prefix based filter criteria If prefixes you specified in multiple rules overlap

            • Same object qualify tag based filter criteria specified in multiple rules

            For more information, see `Replication < https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html>`__ in the Amazon S3 Developer Guide .

          • Prefix (string) --

            An object keyname prefix that identifies the object or objects to which the rule applies. The maximum prefix length is 1,024 characters. To include all objects in a bucket, specify an empty string.

          • Filter (dict) --

            A filter that identifies the subset of objects to which the replication rule applies. A Filter must specify exactly one Prefix , Tag , or an And child element.

            • Prefix (string) --

              An object keyname prefix that identifies the subset of objects to which the rule applies.

            • Tag (dict) --

              A container for specifying a tag key and value.

              The rule applies only to objects that have the tag in their tag set.

              • Key (string) --

                Name of the tag.

              • Value (string) --

                Value of the tag.

            • And (dict) --

              A container for specifying rule filters. The filters determine the subset of objects to which the rule applies. This element is required only if you specify more than one filter. For example:

              • If you specify both a Prefix and a Tag filter, wrap these filters in an And tag.

              • If you specify a filter based on multiple tags, wrap the Tag elements in an And tag.

              • Prefix (string) --

                An object keyname prefix that identifies the subset of objects to which the rule applies.

              • Tags (list) --

                An array of tags containing key and value pairs.

                • (dict) --

                  A container of a key value name pair.

                  • Key (string) --

                    Name of the tag.

                  • Value (string) --

                    Value of the tag.

          • Status (string) --

            Specifies whether the rule is enabled.

          • SourceSelectionCriteria (dict) --

            A container that describes additional filters for identifying the source objects that you want to replicate. You can choose to enable or disable the replication of these objects. Currently, Amazon S3 supports only the filter that you can specify for objects created with server-side encryption using a customer master key (CMK) stored in AWS Key Management Service (SSE-KMS).

            • SseKmsEncryptedObjects (dict) --

              A container for filter information for the selection of Amazon S3 objects encrypted with AWS KMS. If you include SourceSelectionCriteria in the replication configuration, this element is required.

              • Status (string) --

                Specifies whether Amazon S3 replicates objects created with server-side encryption using a customer master key (CMK) stored in AWS Key Management Service.

          • ExistingObjectReplication (dict) --

            A container that specifies information about existing object replication. You can choose whether to enable or disable the replication of existing objects.

            • Status (string) --

              Specifies whether existing object replication is enabled.

          • Destination (dict) --

            A container for information about the replication destination.

            • Bucket (string) --

              The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.

            • Account (string) --

              Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the AWS account that owns the destination bucket by specifying the AccessControlTranslation property, this is the account ID of the destination bucket owner. For more information, see Replication Additional Configuration: Change Replica Owner in the Amazon Simple Storage Service Developer Guide .

            • StorageClass (string) --

              The storage class to use when replicating objects, such as standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.

              For valid values, see the StorageClass element of the PUT Bucket replication action in the Amazon Simple Storage Service API Reference .

            • AccessControlTranslation (dict) --

              Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the AWS account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same AWS account that owns the source object.

              • Owner (string) --

                Specifies the replica ownership. For default and valid values, see PUT bucket replication in the Amazon Simple Storage Service API Reference .

            • EncryptionConfiguration (dict) --

              A container that provides information about encryption. If SourceSelectionCriteria is specified, you must specify this element.

              • ReplicaKmsKeyID (string) --

                Specifies the AWS KMS Key ID (Key ARN or Alias ARN) for the destination bucket. Amazon S3 uses this key to encrypt replica objects.

            • ReplicationTime (dict) --

              A container specifying the time when all objects and operations on objects are replicated. Must be specified together with a Metrics block.

              • Status (string) --

                Specifies whether the replication time is enabled.

              • Time (dict) --

                A container specifying the time by which replication should complete for all objects and operations on objects.

                • Minutes (integer) --

                  Contains an integer specifying time in minutes.

            • Metrics (dict) --

              A container specifying replication metrics-related information, including whether emitting metrics and Amazon S3 events for replication are enabled. In addition, contains configurations related to specific metrics or events. Must be specified together with a ReplicationTime block.

              • Status (string) --

                Specifies whether the replication metrics are enabled.

              • EventThreshold (dict) --

                A container specifying the time threshold for emitting the s3:Replication:OperationMissedThreshold event.

                • Minutes (integer) --

                  Contains an integer specifying time in minutes.

          • DeleteMarkerReplication (dict) --

            Specifies whether Amazon S3 replicates the delete markers. If you specify a Filter , you must specify this element. However, in the latest version of replication configuration (when Filter is specified), Amazon S3 doesn't replicate delete markers. Therefore, the DeleteMarkerReplication element can contain only <Status>Disabled</Status>. For an example configuration, see Basic Rule Configuration .

            Note

            If you don't specify the Filter element, Amazon S3 assumes the replication configuration is the earlier version, V1. In the earlier version, Amazon S3 handled replication of delete markers differently. For more information, see Backward Compatibility .

            • Status (string) --

              Indicates whether to replicate delete markers.

              Note

              In the current implementation, Amazon S3 doesn't replicate the delete markers. The status must be Disabled .

PutBucketNotification (updated) Link ¶
Changes (request)
{'NotificationConfiguration': {'CloudFunctionConfiguration': {'Event': ['s3:Replication:*',
                                                                        's3:ObjectRestore:*',
                                                                        's3:Replication:OperationMissedThreshold',
                                                                        's3:Replication:OperationFailedReplication',
                                                                        's3:Replication:OperationReplicatedAfterThreshold',
                                                                        's3:Replication:OperationNotTracked'],
                                                              'Events': ['s3:Replication:*',
                                                                         's3:ObjectRestore:*',
                                                                         's3:Replication:OperationMissedThreshold',
                                                                         's3:Replication:OperationFailedReplication',
                                                                         's3:Replication:OperationReplicatedAfterThreshold',
                                                                         's3:Replication:OperationNotTracked']},
                               'QueueConfiguration': {'Event': ['s3:Replication:*',
                                                                's3:ObjectRestore:*',
                                                                's3:Replication:OperationMissedThreshold',
                                                                's3:Replication:OperationFailedReplication',
                                                                's3:Replication:OperationReplicatedAfterThreshold',
                                                                's3:Replication:OperationNotTracked'],
                                                      'Events': ['s3:Replication:*',
                                                                 's3:ObjectRestore:*',
                                                                 's3:Replication:OperationMissedThreshold',
                                                                 's3:Replication:OperationFailedReplication',
                                                                 's3:Replication:OperationReplicatedAfterThreshold',
                                                                 's3:Replication:OperationNotTracked']},
                               'TopicConfiguration': {'Event': ['s3:Replication:*',
                                                                's3:ObjectRestore:*',
                                                                's3:Replication:OperationMissedThreshold',
                                                                's3:Replication:OperationFailedReplication',
                                                                's3:Replication:OperationReplicatedAfterThreshold',
                                                                's3:Replication:OperationNotTracked'],
                                                      'Events': ['s3:Replication:*',
                                                                 's3:ObjectRestore:*',
                                                                 's3:Replication:OperationMissedThreshold',
                                                                 's3:Replication:OperationFailedReplication',
                                                                 's3:Replication:OperationReplicatedAfterThreshold',
                                                                 's3:Replication:OperationNotTracked']}}}

No longer used, see the PutBucketNotificationConfiguration operation.

!DANGER!

This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.

See also: AWS API Documentation

Request Syntax

client.put_bucket_notification(
    Bucket='string',
    ContentMD5='string',
    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',
            ],
            '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',
            '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',
            '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',
            ],
            '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',
            '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',
            ],
            'CloudFunction': 'string',
            'InvocationRole': '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.

type NotificationConfiguration

dict

param NotificationConfiguration

[REQUIRED]

The container for the configuration.

  • TopicConfiguration (dict) --

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

      • (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 AWS 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

returns

None

PutBucketNotificationConfiguration (updated) Link ¶
Changes (request)
{'NotificationConfiguration': {'LambdaFunctionConfigurations': {'Events': ['s3:Replication:*',
                                                                           's3:ObjectRestore:*',
                                                                           's3:Replication:OperationMissedThreshold',
                                                                           's3:Replication:OperationFailedReplication',
                                                                           's3:Replication:OperationReplicatedAfterThreshold',
                                                                           's3:Replication:OperationNotTracked']},
                               'QueueConfigurations': {'Events': ['s3:Replication:*',
                                                                  's3:ObjectRestore:*',
                                                                  's3:Replication:OperationMissedThreshold',
                                                                  's3:Replication:OperationFailedReplication',
                                                                  's3:Replication:OperationReplicatedAfterThreshold',
                                                                  's3:Replication:OperationNotTracked']},
                               'TopicConfigurations': {'Events': ['s3:Replication:*',
                                                                  's3:ObjectRestore:*',
                                                                  's3:Replication:OperationMissedThreshold',
                                                                  's3:Replication:OperationFailedReplication',
                                                                  's3:Replication:OperationReplicatedAfterThreshold',
                                                                  's3:Replication:OperationNotTracked']}}}

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 operation 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 AWS 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 operation 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 topic.

The following operations is related to PutBucketNotificationConfiguration :

  • GetBucketNotificationConfiguration

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',
                ],
                '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',
                ],
                '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',
                ],
                'Filter': {
                    'Key': {
                        'FilterRules': [
                            {
                                'Name': 'prefix'|'suffix',
                                'Value': 'string'
                            },
                        ]
                    }
                }
            },
        ]
    }
)
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 Simple Storage Service Developer 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 Simple Storage Service Developer 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 Simple Storage Service Developer 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 notiications

        • (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 Simple Storage Service Developer 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 Simple Storage Service Developer Guide .

              • Value (string) --

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

  • LambdaFunctionConfigurations (list) --

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

    • (dict) --

      A container for specifying the configuration for AWS 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 AWS 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 AWS Lambda function. For more information, see Supported Event Types in the Amazon Simple Storage Service Developer 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 Simple Storage Service Developer 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 Simple Storage Service Developer Guide .

              • Value (string) --

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

returns

None

PutBucketReplication (updated) Link ¶
Changes (request)
{'ReplicationConfiguration': {'Rules': {'Destination': {'Metrics': {'EventThreshold': {'Minutes': 'integer'},
                                                                    'Status': 'Enabled '
                                                                              '| '
                                                                              'Disabled'},
                                                        'ReplicationTime': {'Status': 'Enabled '
                                                                                      '| '
                                                                                      'Disabled',
                                                                            'Time': {'Minutes': 'integer'}}}}}}

Creates a replication configuration or replaces an existing one. For more information, see Replication in the Amazon S3 Developer Guide .

Note

To perform this operation, the user or role performing the operation must have the iam:PassRole permission.

Specify the replication configuration in the request body. In the replication configuration, you provide the name of the destination bucket where you want Amazon S3 to replicate objects, the IAM role that Amazon S3 can assume to replicate objects on your behalf, and other relevant information.

A replication configuration must include at least one rule, and can contain a maximum of 1,000. Each rule identifies a subset of objects to replicate by filtering the objects in the source bucket. To choose additional subsets of objects to replicate, add a rule for each subset. All rules must specify the same destination bucket.

To specify a subset of the objects in the source bucket to apply a replication rule to, add the Filter element as a child of the Rule element. You can filter objects based on an object key prefix, one or more object tags, or both. When you add the Filter element in the configuration, you must also add the following elements: DeleteMarkerReplication , Status , and Priority .

For information about enabling versioning on a bucket, see Using Versioning .

By default, a resource owner, in this case the AWS account that created the bucket, can perform this operation. The resource owner can also grant others permissions to perform the operation. For more information about permissions, see Specifying Permissions in a Policy and Managing Access Permissions to Your Amazon S3 Resources .

Handling Replication of Encrypted Objects

By default, Amazon S3 doesn't replicate objects that are stored at rest using server-side encryption with CMKs stored in AWS KMS. To replicate AWS KMS-encrypted objects, add the following: SourceSelectionCriteria , SseKmsEncryptedObjects , Status , EncryptionConfiguration , and ReplicaKmsKeyID . For information about replication configuration, see Replicating Objects Created with SSE Using CMKs stored in AWS KMS .

PutBucketReplication has the following special errors:

  • Error code: InvalidRequest

    • Description: If the <Owner> in <AccessControlTranslation> has a value, the <Account> element must be specified.

    • HTTP 400

  • Error code: InvalidArgument

    • Description: The <Account> element is empty. It must contain a valid account ID.

    • HTTP 400

  • Error code: InvalidArgument

    • Description: The AWS account specified in the <Account> element must match the destination bucket owner.

    • HTTP 400

The following operations are related to PutBucketReplication :

  • GetBucketReplication

  • DeleteBucketReplication

See also: AWS API Documentation

Request Syntax

client.put_bucket_replication(
    Bucket='string',
    ContentMD5='string',
    ReplicationConfiguration={
        'Role': 'string',
        'Rules': [
            {
                'ID': 'string',
                'Priority': 123,
                'Prefix': 'string',
                'Filter': {
                    'Prefix': 'string',
                    'Tag': {
                        'Key': 'string',
                        'Value': 'string'
                    },
                    'And': {
                        'Prefix': 'string',
                        'Tags': [
                            {
                                'Key': 'string',
                                'Value': 'string'
                            },
                        ]
                    }
                },
                'Status': 'Enabled'|'Disabled',
                'SourceSelectionCriteria': {
                    'SseKmsEncryptedObjects': {
                        'Status': 'Enabled'|'Disabled'
                    }
                },
                'ExistingObjectReplication': {
                    'Status': 'Enabled'|'Disabled'
                },
                'Destination': {
                    'Bucket': 'string',
                    'Account': 'string',
                    'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE',
                    'AccessControlTranslation': {
                        'Owner': 'Destination'
                    },
                    'EncryptionConfiguration': {
                        'ReplicaKmsKeyID': 'string'
                    },
                    'ReplicationTime': {
                        'Status': 'Enabled'|'Disabled',
                        'Time': {
                            'Minutes': 123
                        }
                    },
                    'Metrics': {
                        'Status': 'Enabled'|'Disabled',
                        'EventThreshold': {
                            'Minutes': 123
                        }
                    }
                },
                'DeleteMarkerReplication': {
                    'Status': 'Enabled'|'Disabled'
                }
            },
        ]
    },
    Token='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the bucket

type ContentMD5

string

param ContentMD5

The base64-encoded 128-bit MD5 digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see RFC 1864 .

type ReplicationConfiguration

dict

param ReplicationConfiguration

[REQUIRED]

A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication configuration is 2 MB.

  • Role (string) -- [REQUIRED]

    The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that Amazon S3 assumes when replicating objects. For more information, see How to Set Up Replication in the Amazon Simple Storage Service Developer Guide .

  • Rules (list) -- [REQUIRED]

    A container for one or more replication rules. A replication configuration must have at least one rule and can contain a maximum of 1,000 rules.

    • (dict) --

      Specifies which Amazon S3 objects to replicate and where to store the replicas.

      • ID (string) --

        A unique identifier for the rule. The maximum value is 255 characters.

      • Priority (integer) --

        The priority associated with the rule. If you specify multiple rules in a replication configuration, Amazon S3 prioritizes the rules to prevent conflicts when filtering. If two or more rules identify the same object based on a specified filter, the rule with higher priority takes precedence. For example:

        • Same object quality prefix based filter criteria If prefixes you specified in multiple rules overlap

        • Same object qualify tag based filter criteria specified in multiple rules

        For more information, see `Replication < https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html>`__ in the Amazon S3 Developer Guide .

      • Prefix (string) --

        An object keyname prefix that identifies the object or objects to which the rule applies. The maximum prefix length is 1,024 characters. To include all objects in a bucket, specify an empty string.

      • Filter (dict) --

        A filter that identifies the subset of objects to which the replication rule applies. A Filter must specify exactly one Prefix , Tag , or an And child element.

        • Prefix (string) --

          An object keyname prefix that identifies the subset of objects to which the rule applies.

        • Tag (dict) --

          A container for specifying a tag key and value.

          The rule applies only to objects that have the tag in their tag set.

          • Key (string) -- [REQUIRED]

            Name of the tag.

          • Value (string) -- [REQUIRED]

            Value of the tag.

        • And (dict) --

          A container for specifying rule filters. The filters determine the subset of objects to which the rule applies. This element is required only if you specify more than one filter. For example:

          • If you specify both a Prefix and a Tag filter, wrap these filters in an And tag.

          • If you specify a filter based on multiple tags, wrap the Tag elements in an And tag.

          • Prefix (string) --

            An object keyname prefix that identifies the subset of objects to which the rule applies.

          • Tags (list) --

            An array of tags containing key and value pairs.

            • (dict) --

              A container of a key value name pair.

              • Key (string) -- [REQUIRED]

                Name of the tag.

              • Value (string) -- [REQUIRED]

                Value of the tag.

      • Status (string) -- [REQUIRED]

        Specifies whether the rule is enabled.

      • SourceSelectionCriteria (dict) --

        A container that describes additional filters for identifying the source objects that you want to replicate. You can choose to enable or disable the replication of these objects. Currently, Amazon S3 supports only the filter that you can specify for objects created with server-side encryption using a customer master key (CMK) stored in AWS Key Management Service (SSE-KMS).

        • SseKmsEncryptedObjects (dict) --

          A container for filter information for the selection of Amazon S3 objects encrypted with AWS KMS. If you include SourceSelectionCriteria in the replication configuration, this element is required.

          • Status (string) -- [REQUIRED]

            Specifies whether Amazon S3 replicates objects created with server-side encryption using a customer master key (CMK) stored in AWS Key Management Service.

      • ExistingObjectReplication (dict) --

        A container that specifies information about existing object replication. You can choose whether to enable or disable the replication of existing objects.

        • Status (string) -- [REQUIRED]

          Specifies whether existing object replication is enabled.

      • Destination (dict) -- [REQUIRED]

        A container for information about the replication destination.

        • Bucket (string) -- [REQUIRED]

          The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.

        • Account (string) --

          Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the AWS account that owns the destination bucket by specifying the AccessControlTranslation property, this is the account ID of the destination bucket owner. For more information, see Replication Additional Configuration: Change Replica Owner in the Amazon Simple Storage Service Developer Guide .

        • StorageClass (string) --

          The storage class to use when replicating objects, such as standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.

          For valid values, see the StorageClass element of the PUT Bucket replication action in the Amazon Simple Storage Service API Reference .

        • AccessControlTranslation (dict) --

          Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the AWS account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same AWS account that owns the source object.

          • Owner (string) -- [REQUIRED]

            Specifies the replica ownership. For default and valid values, see PUT bucket replication in the Amazon Simple Storage Service API Reference .

        • EncryptionConfiguration (dict) --

          A container that provides information about encryption. If SourceSelectionCriteria is specified, you must specify this element.

          • ReplicaKmsKeyID (string) --

            Specifies the AWS KMS Key ID (Key ARN or Alias ARN) for the destination bucket. Amazon S3 uses this key to encrypt replica objects.

        • ReplicationTime (dict) --

          A container specifying the time when all objects and operations on objects are replicated. Must be specified together with a Metrics block.

          • Status (string) -- [REQUIRED]

            Specifies whether the replication time is enabled.

          • Time (dict) -- [REQUIRED]

            A container specifying the time by which replication should complete for all objects and operations on objects.

            • Minutes (integer) --

              Contains an integer specifying time in minutes.

        • Metrics (dict) --

          A container specifying replication metrics-related information, including whether emitting metrics and Amazon S3 events for replication are enabled. In addition, contains configurations related to specific metrics or events. Must be specified together with a ReplicationTime block.

          • Status (string) -- [REQUIRED]

            Specifies whether the replication metrics are enabled.

          • EventThreshold (dict) -- [REQUIRED]

            A container specifying the time threshold for emitting the s3:Replication:OperationMissedThreshold event.

            • Minutes (integer) --

              Contains an integer specifying time in minutes.

      • DeleteMarkerReplication (dict) --

        Specifies whether Amazon S3 replicates the delete markers. If you specify a Filter , you must specify this element. However, in the latest version of replication configuration (when Filter is specified), Amazon S3 doesn't replicate delete markers. Therefore, the DeleteMarkerReplication element can contain only <Status>Disabled</Status>. For an example configuration, see Basic Rule Configuration .

        Note

        If you don't specify the Filter element, Amazon S3 assumes the replication configuration is the earlier version, V1. In the earlier version, Amazon S3 handled replication of delete markers differently. For more information, see Backward Compatibility .

        • Status (string) --

          Indicates whether to replicate delete markers.

          Note

          In the current implementation, Amazon S3 doesn't replicate the delete markers. The status must be Disabled .

type Token

string

param Token

returns

None