ReplicationRule Struct
Specifies which Amazon S3 objects to replicate and where to store the replicas.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const bucket: s3.Bucket;
declare const key: kms.Key;
declare const replicationTimeValue: s3.ReplicationTimeValue;
declare const storageClass: s3.StorageClass;
const replicationRule: s3.ReplicationRule = {
destination: bucket,
// the properties below are optional
accessControlTransition: false,
deleteMarkerReplication: false,
filter: {
prefix: 'prefix',
tags: [{
key: 'key',
value: 'value',
}],
},
id: 'id',
kmsKey: key,
metrics: replicationTimeValue,
priority: 123,
replicaModifications: false,
replicationTimeControl: replicationTimeValue,
sseKmsEncryptedObjects: false,
storageClass: storageClass,
};
Properties
accessControlTransitionoptionalbooleanaccess_control_transitionoptionalboolaccessControlTransitionoptionalBooleanAccessControlTransitionoptionalboolAccessControlTransitionoptional*bool#Default: The replicas are owned by the source object owner, unless the destination bucket uses ObjectOwnership.BUCKET_OWNER_ENFORCED
notes
This can only be specified if the source bucket and the destination bucket are not in the same AWS account.
When enabled, use addReplicationPolicy() on the destination bucket with the source bucket owner's account ID to grant the required permissions.
This is not required when the destination bucket uses ObjectOwnership.BUCKET_OWNER_ENFORCED, because the destination bucket owner automatically owns all objects.
deleteMarkerReplicationoptionalbooleandelete_marker_replicationoptionalbooldeleteMarkerReplicationoptionalBooleanDeleteMarkerReplicationoptionalboolDeleteMarkerReplicationoptional*bool#Default: delete markers in source bucket is not replicated to destination bucket
notes
The destination can be in the same AWS account or a different account.
For cross-account replication, the destination bucket must have a policy that allows the source bucket to replicate objects to it. Use addReplicationPolicy() to add the required permissions when the destination bucket is managed by CDK. If the destination bucket is referenced, configure the policy separately in the destination account.
When importing a cross-account destination into the source stack, use Bucket.fromBucketAttributes() and set the account attribute to the destination bucket owner's account ID. Bucket.fromBucketArn() and Bucket.fromBucketName() assume the bucket is owned by the same account as the scope in which it is imported.
filteroptionalFilterfilteroptionalFilterfilteroptionalFilterFilteroptionalFilterFilteroptionalFilter#Default: applies to all objects
Default: auto generated random ID
The maximum value is 255 characters.
Default: Amazon S3 uses the AWS managed KMS key for encryption
Amazon S3 uses this key to encrypt replica objects.
Amazon S3 only supports symmetric encryption KMS keys.
metricsoptionalReplicationTimeValuemetricsoptionalReplicationTimeValuemetricsoptionalReplicationTimeValueMetricsoptionalReplicationTimeValueMetricsoptionalReplicationTimeValue#Default: Replication metrics are not enabled
The specified eventThreshold duration takes effect only when replicationTimeControl is enabled . Otherwise, the duration is ignored and replication metrics are enabled without an event threshold.
priorityoptionalnumberpriorityoptionalint | floatpriorityoptionalNumberPriorityoptionaldoublePriorityoptional*float64= 0#notes
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.
replicaModificationsoptionalbooleanreplica_modificationsoptionalboolreplicaModificationsoptionalBooleanReplicaModificationsoptionalboolReplicaModificationsoptional*bool= false#replicationTimeControloptionalReplicationTimeValuereplication_time_controloptionalReplicationTimeValuereplicationTimeControloptionalReplicationTimeValueReplicationTimeControloptionalReplicationTimeValueReplicationTimeControloptionalReplicationTimeValue#Default: S3 Replication Time Control is not enabled
sseKmsEncryptedObjectsoptionalbooleansse_kms_encrypted_objectsoptionalboolsseKmsEncryptedObjectsoptionalBooleanSseKmsEncryptedObjectsoptionalboolSseKmsEncryptedObjectsoptional*bool= false#storageClassoptionalStorageClassstorage_classoptionalStorageClassstorageClassoptionalStorageClassStorageClassoptionalStorageClassStorageClassoptionalStorageClass#Default: The storage class of the source object