Skip to content
v2.278.0

ReplicationTimeValue Class ​

The replication time value used for S3 Replication Time Control (S3 RTC).

Example ​

ts
declare const destinationBucket1: s3.IBucket;
declare const destinationBucket2: s3.IBucket;
declare const replicationRole: iam.IRole;
declare const encryptionKey: kms.IKey;
declare const destinationEncryptionKey: kms.IKey;

const sourceBucket = new s3.Bucket(this, 'SourceBucket', {
  // Versioning must be enabled on both the source and destination bucket
  versioned: true,
  // Optional. Specify the KMS key to use for encrypts objects in the source bucket.
  encryptionKey,
  // Optional. If not specified, a new role will be created.
  replicationRole,
  replicationRules: [
    {
      // The destination bucket for the replication rule.
      destination: destinationBucket1,
      // The priority of the rule.
      // 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.
      priority: 1,
    },
    {
      destination: destinationBucket2,
      priority: 2,
      // Whether to specify S3 Replication Time Control (S3 RTC).
      // S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
      // and 99.99 percent of those objects within specified time.
      replicationTimeControl: s3.ReplicationTimeValue.FIFTEEN_MINUTES,
      // Whether to enable replication metrics about S3 RTC.
      // If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
      metrics: s3.ReplicationTimeValue.FIFTEEN_MINUTES,
      // The kms key to use for the destination bucket.
      kmsKey: destinationEncryptionKey,
      // The storage class to use for the destination bucket.
      storageClass: s3.StorageClass.INFREQUENT_ACCESS,
      // Whether to replicate objects with SSE-KMS encryption.
      sseKmsEncryptedObjects: false,
      // Whether to replicate modifications on replicas.
      replicaModifications: true,
      // Whether to replicate delete markers.
      // This property cannot be enabled if the replication rule has a tag filter.
      deleteMarkerReplication: false,
      // The ID of the rule.
      id: 'full-settings-rule',
      // The object filter for the rule.
      filter: {
        // The prefix filter for the rule.
        prefix: 'prefix',
        // The tag filter for the rule.
        tags: [
          {
            key: 'tagKey',
            value: 'tagValue',
          },
        ],
      }
    },
  ],
});

// Grant permissions to the replication role.
// This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
sourceBucket.grantReplicationPermission(replicationRole, {
  // Optional. Specify the KMS key to use for decrypting objects in the source bucket.
  sourceDecryptionKey: encryptionKey,
  destinations: [
    { bucket: destinationBucket1 },
    { bucket: destinationBucket2, encryptionKey: destinationEncryptionKey },
  ],
  // The 'encryptionKey' property within the 'destinations' array is optional.
  // If not specified for a destination bucket, this method assumes that
  // given destination bucket is not encrypted.
});
python
# destination_bucket1: s3.IBucket
# destination_bucket2: s3.IBucket
# replication_role: iam.IRole
# encryption_key: kms.IKey
# destination_encryption_key: kms.IKey


source_bucket = s3.Bucket(self, "SourceBucket",
    # Versioning must be enabled on both the source and destination bucket
    versioned=True,
    # Optional. Specify the KMS key to use for encrypts objects in the source bucket.
    encryption_key=encryption_key,
    # Optional. If not specified, a new role will be created.
    replication_role=replication_role,
    replication_rules=[s3.ReplicationRule(
        # The destination bucket for the replication rule.
        destination=destination_bucket1,
        # The priority of the rule.
        # 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.
        priority=1
    ), s3.ReplicationRule(
        destination=destination_bucket2,
        priority=2,
        # Whether to specify S3 Replication Time Control (S3 RTC).
        # S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
        # and 99.99 percent of those objects within specified time.
        replication_time_control=s3.ReplicationTimeValue.FIFTEEN_MINUTES,
        # Whether to enable replication metrics about S3 RTC.
        # If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
        metrics=s3.ReplicationTimeValue.FIFTEEN_MINUTES,
        # The kms key to use for the destination bucket.
        kms_key=destination_encryption_key,
        # The storage class to use for the destination bucket.
        storage_class=s3.StorageClass.INFREQUENT_ACCESS,
        # Whether to replicate objects with SSE-KMS encryption.
        sse_kms_encrypted_objects=False,
        # Whether to replicate modifications on replicas.
        replica_modifications=True,
        # Whether to replicate delete markers.
        # This property cannot be enabled if the replication rule has a tag filter.
        delete_marker_replication=False,
        # The ID of the rule.
        id="full-settings-rule",
        # The object filter for the rule.
        filter=s3.Filter(
            # The prefix filter for the rule.
            prefix="prefix",
            # The tag filter for the rule.
            tags=[s3.Tag(
                key="tagKey",
                value="tagValue"
            )
            ]
        )
    )
    ]
)

# Grant permissions to the replication role.
# This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
source_bucket.grant_replication_permission(replication_role,
    # Optional. Specify the KMS key to use for decrypting objects in the source bucket.
    source_decryption_key=encryption_key,
    destinations=[s3.GrantReplicationPermissionDestinationProps(bucket=destination_bucket1), s3.GrantReplicationPermissionDestinationProps(bucket=destination_bucket2, encryption_key=destination_encryption_key)
    ]
)
java
IBucket destinationBucket1;
IBucket destinationBucket2;
IRole replicationRole;
IKey encryptionKey;
IKey destinationEncryptionKey;


Bucket sourceBucket = Bucket.Builder.create(this, "SourceBucket")
        // Versioning must be enabled on both the source and destination bucket
        .versioned(true)
        // Optional. Specify the KMS key to use for encrypts objects in the source bucket.
        .encryptionKey(encryptionKey)
        // Optional. If not specified, a new role will be created.
        .replicationRole(replicationRole)
        .replicationRules(List.of(ReplicationRule.builder()
                // The destination bucket for the replication rule.
                .destination(destinationBucket1)
                // The priority of the rule.
                // 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.
                .priority(1)
                .build(), ReplicationRule.builder()
                .destination(destinationBucket2)
                .priority(2)
                // Whether to specify S3 Replication Time Control (S3 RTC).
                // S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
                // and 99.99 percent of those objects within specified time.
                .replicationTimeControl(ReplicationTimeValue.FIFTEEN_MINUTES)
                // Whether to enable replication metrics about S3 RTC.
                // If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
                .metrics(ReplicationTimeValue.FIFTEEN_MINUTES)
                // The kms key to use for the destination bucket.
                .kmsKey(destinationEncryptionKey)
                // The storage class to use for the destination bucket.
                .storageClass(StorageClass.INFREQUENT_ACCESS)
                // Whether to replicate objects with SSE-KMS encryption.
                .sseKmsEncryptedObjects(false)
                // Whether to replicate modifications on replicas.
                .replicaModifications(true)
                // Whether to replicate delete markers.
                // This property cannot be enabled if the replication rule has a tag filter.
                .deleteMarkerReplication(false)
                // The ID of the rule.
                .id("full-settings-rule")
                // The object filter for the rule.
                .filter(Filter.builder()
                        // The prefix filter for the rule.
                        .prefix("prefix")
                        // The tag filter for the rule.
                        .tags(List.of(Tag.builder()
                                .key("tagKey")
                                .value("tagValue")
                                .build()))
                        .build())
                .build()))
        .build();

// Grant permissions to the replication role.
// This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
sourceBucket.grantReplicationPermission(replicationRole, GrantReplicationPermissionProps.builder()
        // Optional. Specify the KMS key to use for decrypting objects in the source bucket.
        .sourceDecryptionKey(encryptionKey)
        .destinations(List.of(GrantReplicationPermissionDestinationProps.builder().bucket(destinationBucket1).build(), GrantReplicationPermissionDestinationProps.builder().bucket(destinationBucket2).encryptionKey(destinationEncryptionKey).build()))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
IBucket destinationBucket1;
IBucket destinationBucket2;
IRole replicationRole;
IKey encryptionKey;
IKey destinationEncryptionKey;


var sourceBucket = new Bucket(this, "SourceBucket", new BucketProps {
    // Versioning must be enabled on both the source and destination bucket
    Versioned = true,
    // Optional. Specify the KMS key to use for encrypts objects in the source bucket.
    EncryptionKey = encryptionKey,
    // Optional. If not specified, a new role will be created.
    ReplicationRole = replicationRole,
    ReplicationRules = new [] { new ReplicationRule {
        // The destination bucket for the replication rule.
        Destination = destinationBucket1,
        // The priority of the rule.
        // 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.
        Priority = 1
    }, new ReplicationRule {
        Destination = destinationBucket2,
        Priority = 2,
        // Whether to specify S3 Replication Time Control (S3 RTC).
        // S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
        // and 99.99 percent of those objects within specified time.
        ReplicationTimeControl = ReplicationTimeValue.FIFTEEN_MINUTES,
        // Whether to enable replication metrics about S3 RTC.
        // If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
        Metrics = ReplicationTimeValue.FIFTEEN_MINUTES,
        // The kms key to use for the destination bucket.
        KmsKey = destinationEncryptionKey,
        // The storage class to use for the destination bucket.
        StorageClass = StorageClass.INFREQUENT_ACCESS,
        // Whether to replicate objects with SSE-KMS encryption.
        SseKmsEncryptedObjects = false,
        // Whether to replicate modifications on replicas.
        ReplicaModifications = true,
        // Whether to replicate delete markers.
        // This property cannot be enabled if the replication rule has a tag filter.
        DeleteMarkerReplication = false,
        // The ID of the rule.
        Id = "full-settings-rule",
        // The object filter for the rule.
        Filter = new Filter {
            // The prefix filter for the rule.
            Prefix = "prefix",
            // The tag filter for the rule.
            Tags = new [] { new Tag {
                Key = "tagKey",
                Value = "tagValue"
            } }
        }
    } }
});

// Grant permissions to the replication role.
// This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
sourceBucket.GrantReplicationPermission(replicationRole, new GrantReplicationPermissionProps {
    // Optional. Specify the KMS key to use for decrypting objects in the source bucket.
    SourceDecryptionKey = encryptionKey,
    Destinations = new [] { new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket1 }, new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket2, EncryptionKey = destinationEncryptionKey } }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var destinationBucket1 IBucket
var destinationBucket2 IBucket
var replicationRole IRole
var encryptionKey IKey
var destinationEncryptionKey IKey


sourceBucket := s3.NewBucket(this, jsii.String("SourceBucket"), &BucketProps{
	// Versioning must be enabled on both the source and destination bucket
	Versioned: jsii.Boolean(true),
	// Optional. Specify the KMS key to use for encrypts objects in the source bucket.
	EncryptionKey: EncryptionKey,
	// Optional. If not specified, a new role will be created.
	ReplicationRole: ReplicationRole,
	ReplicationRules: []ReplicationRule{
		&ReplicationRule{
			// The destination bucket for the replication rule.
			Destination: destinationBucket1,
			// The priority of the rule.
			// 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.
			Priority: jsii.Number(1),
		},
		&ReplicationRule{
			Destination: destinationBucket2,
			Priority: jsii.Number(2),
			// Whether to specify S3 Replication Time Control (S3 RTC).
			// S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
			// and 99.99 percent of those objects within specified time.
			ReplicationTimeControl: s3.ReplicationTimeValue_FIFTEEN_MINUTES(),
			// Whether to enable replication metrics about S3 RTC.
			// If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
			Metrics: s3.ReplicationTimeValue_FIFTEEN_MINUTES(),
			// The kms key to use for the destination bucket.
			KmsKey: destinationEncryptionKey,
			// The storage class to use for the destination bucket.
			StorageClass: s3.StorageClass_INFREQUENT_ACCESS(),
			// Whether to replicate objects with SSE-KMS encryption.
			SseKmsEncryptedObjects: jsii.Boolean(false),
			// Whether to replicate modifications on replicas.
			ReplicaModifications: jsii.Boolean(true),
			// Whether to replicate delete markers.
			// This property cannot be enabled if the replication rule has a tag filter.
			DeleteMarkerReplication: jsii.Boolean(false),
			// The ID of the rule.
			Id: jsii.String("full-settings-rule"),
			// The object filter for the rule.
			Filter: &Filter{
				// The prefix filter for the rule.
				Prefix: jsii.String("prefix"),
				// The tag filter for the rule.
				Tags: []Tag{
					&Tag{
						Key: jsii.String("tagKey"),
						Value: jsii.String("tagValue"),
					},
				},
			},
		},
	},
})

// Grant permissions to the replication role.
// This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
sourceBucket.GrantReplicationPermission(replicationRole, &GrantReplicationPermissionProps{
	// Optional. Specify the KMS key to use for decrypting objects in the source bucket.
	SourceDecryptionKey: encryptionKey,
	Destinations: []GrantReplicationPermissionDestinationProps{
		&GrantReplicationPermissionDestinationProps{
			Bucket: destinationBucket1,
		},
		&GrantReplicationPermissionDestinationProps{
			Bucket: destinationBucket2,
			EncryptionKey: destinationEncryptionKey,
		},
	},
})

Properties ​

FIFTEEN_MINUTESReplicationTimeValueFIFTEEN_MINUTESReplicationTimeValueFIFTEEN_MINUTESReplicationTimeValueFIFTEEN_MINUTESReplicationTimeValueFIFTEEN_MINUTESReplicationTimeValue static #
Fifteen minutes.
minutesnumberminutesint | floatminutesNumberMinutesdoubleMinutes*float64 #
the time in minutes.