interface LifecycleRule
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.S3.LifecycleRule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awss3#LifecycleRule |
Java | software.amazon.awscdk.services.s3.LifecycleRule |
Python | aws_cdk.aws_s3.LifecycleRule |
TypeScript (source) | aws-cdk-lib » aws_s3 » LifecycleRule |
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
Name | Type | Description |
---|---|---|
abort | Duration | Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. |
enabled? | boolean | Whether this rule is enabled. |
expiration? | Duration | Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. |
expiration | date | Indicates when objects are deleted from Amazon S3 and Amazon Glacier. |
expired | boolean | Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. |
id? | string | A unique identifier for this rule. |
noncurrent | Duration | Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire. |
noncurrent | Noncurrent [] | One or more transition rules that specify when non-current objects transition to a specified storage class. |
noncurrent | number | Indicates a maximum number of noncurrent versions to retain. |
object | number | Specifies the minimum object size in bytes for this rule to apply to. |
object | number | Specifies the maximum object size in bytes for this rule to apply to. |
prefix? | string | Object key prefix that identifies one or more objects to which this rule applies. |
tag | { [string]: any } | The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket. |
transitions? | Transition [] | One or more transition rules that specify when an object transitions to a specified storage class. |
abortIncompleteMultipartUploadAfter?
Type:
Duration
(optional, default: Incomplete uploads are never aborted)
Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket.
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.
enabled?
Type:
boolean
(optional, default: true)
Whether this rule is enabled.
expiration?
Type:
Duration
(optional, default: No expiration timeout)
Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier.
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.
expirationDate?
Type:
date
(optional, default: No expiration date)
Indicates when objects are deleted from Amazon S3 and Amazon Glacier.
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.
expiredObjectDeleteMarker?
Type:
boolean
(optional, default: false)
Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions.
If set to true, the delete marker will be expired.
id?
Type:
string
(optional)
A unique identifier for this rule.
The value cannot be more than 255 characters.
noncurrentVersionExpiration?
Type:
Duration
(optional, default: No noncurrent version expiration)
Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire.
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.
noncurrentVersionTransitions?
Type:
Noncurrent
[]
(optional)
One or more transition rules that specify when non-current objects transition to a specified storage class.
Only for 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.
noncurrentVersionsToRetain?
Type:
number
(optional, default: No noncurrent versions to retain)
Indicates a maximum number of noncurrent versions to retain.
If there are this many more noncurrent versions, Amazon S3 permanently deletes them.
objectSizeGreaterThan?
Type:
number
(optional, default: No rule)
Specifies the minimum object size in bytes for this rule to apply to.
Objects must be larger than this value in bytes.
objectSizeLessThan?
Type:
number
(optional, default: No rule)
Specifies the maximum object size in bytes for this rule to apply to.
Objects must be smaller than this value in bytes.
prefix?
Type:
string
(optional, default: Rule applies to all objects)
Object key prefix that identifies one or more objects to which this rule applies.
tagFilters?
Type:
{ [string]: any }
(optional, default: Rule applies to all objects)
The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket.
transitions?
Type:
Transition
[]
(optional, default: No transition rules)
One or more transition rules that specify when an object transitions to a specified storage class.
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.