ReplicationRule

class aws_cdk.aws_s3.ReplicationRule(*, destination, access_control_transition=None, delete_marker_replication=None, filter=None, id=None, kms_key=None, metrics=None, priority=None, replica_modifications=None, replication_time_control=None, sse_kms_encrypted_objects=None, storage_class=None)

Bases: object

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

Parameters:
  • destination (IBucket) – The destination bucket for the replicated objects. The destination can be either in the same AWS account or a cross account. If you want to configure cross-account replication, the destination bucket must have a policy that allows the source bucket to replicate objects to it.

  • access_control_transition (Optional[bool]) – Whether to want to change replica ownership to the AWS account that owns the destination bucket. This can only be specified if the source bucket and the destination bucket are not in the same AWS account. Default: - The replicas are owned by same AWS account that owns the source object

  • delete_marker_replication (Optional[bool]) – Specifies whether Amazon S3 replicates delete markers. Default: - delete markers in source bucket is not replicated to destination bucket

  • filter (Union[Filter, Dict[str, Any], None]) – A filter that identifies the subset of objects to which the replication rule applies. Default: - applies to all objects

  • id (Optional[str]) – A unique identifier for the rule. The maximum value is 255 characters. Default: - auto generated random ID

  • kms_key (Optional[IKey]) – The customer managed AWS KMS key stored in AWS Key Management Service (KMS) for the destination bucket. Amazon S3 uses this key to encrypt replica objects. Amazon S3 only supports symmetric encryption KMS keys. Default: - Amazon S3 uses the AWS managed KMS key for encryption

  • metrics (Optional[ReplicationTimeValue]) – A container specifying replication metrics-related settings enabling replication metrics and events. When a value is set, metrics will be output to indicate whether the replication took longer than the specified time. Default: - Replication metrics are not enabled

  • priority (Union[int, float, None]) – The priority indicates which rule has precedence whenever two or more replication rules conflict. Amazon S3 will attempt to replicate objects according to all replication rules. However, if there are two or more rules with the same destination bucket, then objects will be replicated according to the rule with the highest priority. The higher the number, the higher the priority. It is essential to specify priority explicitly when the replication configuration has multiple rules. Default: 0

  • replica_modifications (Optional[bool]) – Specifies whether Amazon S3 replicates modifications on replicas. Default: false

  • replication_time_control (Optional[ReplicationTimeValue]) – Specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Default: - S3 Replication Time Control is not enabled

  • sse_kms_encrypted_objects (Optional[bool]) – Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service. Default: false

  • storage_class (Optional[StorageClass]) – The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. Default: - The storage class of the source object

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_kms as kms
from aws_cdk import aws_s3 as s3

# bucket: s3.Bucket
# key: kms.Key
# replication_time_value: s3.ReplicationTimeValue
# storage_class: s3.StorageClass

replication_rule = s3.ReplicationRule(
    destination=bucket,

    # the properties below are optional
    access_control_transition=False,
    delete_marker_replication=False,
    filter=s3.Filter(
        prefix="prefix",
        tags=[s3.Tag(
            key="key",
            value="value"
        )]
    ),
    id="id",
    kms_key=key,
    metrics=replication_time_value,
    priority=123,
    replica_modifications=False,
    replication_time_control=replication_time_value,
    sse_kms_encrypted_objects=False,
    storage_class=storage_class
)

Attributes

access_control_transition

Whether to want to change replica ownership to the AWS account that owns the destination bucket.

This can only be specified if the source bucket and the destination bucket are not in the same AWS account.

Default:
  • The replicas are owned by same AWS account that owns the source object

delete_marker_replication

Specifies whether Amazon S3 replicates delete markers.

Default:
  • delete markers in source bucket is not replicated to destination bucket

See:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-marker-replication.html

destination

The destination bucket for the replicated objects.

The destination can be either in the same AWS account or a cross account.

If you want to configure cross-account replication, the destination bucket must have a policy that allows the source bucket to replicate objects to it.

See:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-walkthrough-2.html

filter

A filter that identifies the subset of objects to which the replication rule applies.

Default:
  • applies to all objects

id

A unique identifier for the rule.

The maximum value is 255 characters.

Default:
  • auto generated random ID

kms_key

The customer managed AWS KMS key stored in AWS Key Management Service (KMS) for the destination bucket.

Amazon S3 uses this key to encrypt replica objects.

Amazon S3 only supports symmetric encryption KMS keys.

Default:
  • Amazon S3 uses the AWS managed KMS key for encryption

See:

https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html

metrics

A container specifying replication metrics-related settings enabling replication metrics and events.

When a value is set, metrics will be output to indicate whether the replication took longer than the specified time.

Default:
  • Replication metrics are not enabled

priority

The priority indicates which rule has precedence whenever two or more replication rules conflict.

Amazon S3 will attempt to replicate objects according to all replication rules. However, if there are two or more rules with the same destination bucket, then objects will be replicated according to the rule with the highest priority.

The higher the number, the higher the priority.

It is essential to specify priority explicitly when the replication configuration has multiple rules.

Default:

0

replica_modifications

Specifies whether Amazon S3 replicates modifications on replicas.

Default:

false

replication_time_control

Specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated.

Default:
  • S3 Replication Time Control is not enabled

sse_kms_encrypted_objects

Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service.

Default:

false

storage_class

The storage class to use when replicating objects, such as S3 Standard or reduced redundancy.

Default:
  • The storage class of the source object