LifecycleRule Struct
Declaration of a Life cycle rule.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const storageClass: s3.StorageClass;
declare const tagFilters: any;
const lifecycleRule: s3.LifecycleRule = {
abortIncompleteMultipartUploadAfter: cdk.Duration.minutes(30),
enabled: false,
expiration: cdk.Duration.minutes(30),
expirationDate: new Date(),
expiredObjectDeleteMarker: false,
id: 'id',
noncurrentVersionExpiration: cdk.Duration.minutes(30),
noncurrentVersionsToRetain: 123,
noncurrentVersionTransitions: [{
storageClass: storageClass,
transitionAfter: cdk.Duration.minutes(30),
// the properties below are optional
noncurrentVersionsToRetain: 123,
}],
objectSizeGreaterThan: 123,
objectSizeLessThan: 123,
prefix: 'prefix',
tagFilters: {
tagFiltersKey: tagFilters,
},
transitions: [{
storageClass: storageClass,
// the properties below are optional
transitionAfter: cdk.Duration.minutes(30),
transitionDate: new Date(),
}],
};
Properties
abortIncompleteMultipartUploadAfteroptionalDurationabort_incomplete_multipart_upload_afteroptionalDurationabortIncompleteMultipartUploadAfteroptionalDurationAbortIncompleteMultipartUploadAfteroptionalDurationAbortIncompleteMultipartUploadAfteroptionalDuration#Default: Incomplete uploads are never aborted
notes
The AbortIncompleteMultipartUpload property type creates a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. When Amazon S3 aborts a multipart upload, it deletes all parts associated with the multipart upload.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool= true#expirationoptionalDurationexpirationoptionalDurationexpirationoptionalDurationExpirationoptionalDurationExpirationoptionalDuration#Default: No expiration timeout
notes
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
expirationDateoptionaldateexpiration_dateoptionaldatetimeexpirationDateoptionalInstantExpirationDateoptionalDateTimeExpirationDateoptional*time.Time#Default: No expiration date
notes
The date value must be in ISO 8601 format. The time is always midnight UTC.
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.
expiredObjectDeleteMarkeroptionalbooleanexpired_object_delete_markeroptionalboolexpiredObjectDeleteMarkeroptionalBooleanExpiredObjectDeleteMarkeroptionalboolExpiredObjectDeleteMarkeroptional*bool= false#If set to true, the delete marker will be expired.
The value cannot be more than 255 characters.
noncurrentVersionExpirationoptionalDurationnoncurrent_version_expirationoptionalDurationnoncurrentVersionExpirationoptionalDurationNoncurrentVersionExpirationoptionalDurationNoncurrentVersionExpirationoptionalDuration#Default: No noncurrent version expiration
notes
For buckets with versioning enabled (or suspended), specifies the time, in days, between when a new version of the object is uploaded to the bucket and when old versions of the object expire. When object versions expire, Amazon S3 permanently deletes them. If you specify a transition and expiration time, the expiration time must be later than the transition time.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
noncurrentVersionsToRetainoptionalnumbernoncurrent_versions_to_retainoptionalint | floatnoncurrentVersionsToRetainoptionalNumberNoncurrentVersionsToRetainoptionaldoubleNoncurrentVersionsToRetainoptional*float64#Default: No noncurrent versions to retain
If there are this many more noncurrent versions, Amazon S3 permanently deletes them.
noncurrentVersionTransitionsoptionalNoncurrentVersionTransition[]noncurrent_version_transitionsoptionaltyping.List[NoncurrentVersionTransition]noncurrentVersionTransitionsoptionalList<NoncurrentVersionTransition>NoncurrentVersionTransitionsoptionalNoncurrentVersionTransition[]NoncurrentVersionTransitionsoptional*[]NoncurrentVersionTransition#Only for buckets with versioning enabled (or suspended).
If you specify a transition and expiration time, the expiration time must be later than the transition time.
objectSizeGreaterThanoptionalnumberobject_size_greater_thanoptionalint | floatobjectSizeGreaterThanoptionalNumberObjectSizeGreaterThanoptionaldoubleObjectSizeGreaterThanoptional*float64#Default: No rule
Objects must be larger than this value in bytes.
objectSizeLessThanoptionalnumberobject_size_less_thanoptionalint | floatobjectSizeLessThanoptionalNumberObjectSizeLessThanoptionaldoubleObjectSizeLessThanoptional*float64#Default: No rule
Objects must be smaller than this value in bytes.
Default: Rule applies to all objects
tagFiltersoptional{ [key: string]: any }tag_filtersoptionaltyping.Mapping[str, Any]tagFiltersoptionalMap<String, Object>TagFiltersoptionalIDictionary<string, object>TagFiltersoptional*map[string]interface{}#Default: Rule applies to all objects
transitionsoptionalTransition[]transitionsoptionaltyping.List[Transition]transitionsoptionalList<Transition>TransitionsoptionalTransition[]Transitionsoptional*[]Transition#Default: No transition rules
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.