interface ReplicationRule
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.S3.ReplicationRule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awss3#ReplicationRule |
Java | software.amazon.awscdk.services.s3.ReplicationRule |
Python | aws_cdk.aws_s3.ReplicationRule |
TypeScript (source) | aws-cdk-lib » aws_s3 » ReplicationRule |
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
| Name | Type | Description |
|---|---|---|
| destination | IBucket | The destination bucket for the replicated objects. |
| access | boolean | Whether to change replica ownership to the AWS account that owns the destination bucket. |
| delete | boolean | Specifies whether Amazon S3 replicates delete markers. |
| filter? | Filter | A filter that identifies the subset of objects to which the replication rule applies. |
| id? | string | A unique identifier for the rule. |
| kms | IKey | The customer managed AWS KMS key stored in AWS Key Management Service (KMS) for the destination bucket. |
| metrics? | Replication | A container specifying replication metrics-related settings enabling replication metrics and events. |
| priority? | number | The priority indicates which rule has precedence whenever two or more replication rules conflict. |
| replica | boolean | Specifies whether Amazon S3 replicates modifications on replicas. |
| replication | Replication | 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. |
| sse | boolean | Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service. |
| storage | Storage | The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. |
destination
Type:
IBucket
The destination bucket for the replicated objects.
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.
accessControlTransition?
Type:
boolean
(optional, default: The replicas are owned by the source object owner, unless the destination bucket uses
ObjectOwnership.BUCKET_OWNER_ENFORCED)
Whether 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.
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.
deleteMarkerReplication?
Type:
boolean
(optional, default: delete markers in source bucket is not replicated to destination bucket)
Specifies whether Amazon S3 replicates delete markers.
filter?
Type:
Filter
(optional, default: applies to all objects)
A filter that identifies the subset of objects to which the replication rule applies.
id?
Type:
string
(optional, default: auto generated random ID)
A unique identifier for the rule.
The maximum value is 255 characters.
kmsKey?
Type:
IKey
(optional, default: Amazon S3 uses the AWS managed KMS key for encryption)
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.
See also: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
metrics?
Type:
Replication
(optional, default: Replication metrics are not enabled)
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.
priority?
Type:
number
(optional, default: 0)
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.
replicaModifications?
Type:
boolean
(optional, default: false)
Specifies whether Amazon S3 replicates modifications on replicas.
replicationTimeControl?
Type:
Replication
(optional, default: S3 Replication Time Control is not enabled)
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.
sseKmsEncryptedObjects?
Type:
boolean
(optional, default: false)
Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service.
storageClass?
Type:
Storage
(optional, default: The storage class of the source object)
The storage class to use when replicating objects, such as S3 Standard or reduced redundancy.

.NET
Go
Java
Python
TypeScript (