Describe the bug
Using the lifecycleRules configuration of a versioned bucket, I cannot specify how many noncurrent versions to retain without triggering any storage transition. (I want the objects to stay in STANDARD tier but that is also not available under s3.StorageClass.)
What I'm trying to achieve
I want to delete all object versions older than one day but I want to keep the five latest versions for each object (in the same storage tier). I don't want the older versions to transition to another tier since I also want to delete them after a single day if, i.e., another batch of 5 versions comes through.
Expected Behavior
The Console seems to allow exactly what I'm going after:

Current Behavior
Currently, the option for how many noncurrent versions to retain noncurrentVersionsToRetain is under the noncurrentVersionTransitions configuration option, which forces to specify transitionAfter and storageClass. The Console UI (see above) suggests that I would not need to specify these and only need specify noncurrentVersionExpiration.
{
enabled: true,
prefix: "usr_",
noncurrentVersionExpiration: Duration.days(1),
expiredObjectDeleteMarker: true,
abortIncompleteMultipartUploadAfter: Duration.days(1),
noncurrentVersionTransitions: [
{
transitionAfter: Duration.days(1),
noncurrentVersionsToRetain: 5,
storageClass: /* Side issue: There is no s3.StorageClass.STANDARD */
}
]
}
Reproduction Steps
Here is the Object I'm trying to create with the noncurrentVersionTransitions config option commented out:
new s3.Bucket(this, 'bugBucket', {
versioned: true,
lifecycleRules: [
{
enabled: true,
prefix: "prefix",
noncurrentVersionExpiration: Duration.days(1),
expiredObjectDeleteMarker: true,
abortIncompleteMultipartUploadAfter: Duration.days(1),
// noncurrentVersionTransitions: [
// {
// transitionAfter: Duration.days(1),
// noncurrentVersionsToRetain: 5,
// storageClass: /* */
// }
// ]
}
]
});
Possible Solution
Judging by the UI, it looks like noncurrentVersionsToRetain should be a property of the Lifecycle rule and not nested into noncurrentVersionTransitions.
Additional Information/Context
No response
CDK CLI Version
2.19.0 (build e0d3e62)
Framework Version
aws-cdk-lib@2.8.0
Node.js Version
v16.13.2
OS
Ubuntu 20.04
Language
Typescript
Language Version
No response
Other information
No response
Describe the bug
Using the
lifecycleRulesconfiguration of a versioned bucket, I cannot specify how many noncurrent versions to retain without triggering any storage transition. (I want the objects to stay in STANDARD tier but that is also not available unders3.StorageClass.)What I'm trying to achieve
I want to delete all object versions older than one day but I want to keep the five latest versions for each object (in the same storage tier). I don't want the older versions to transition to another tier since I also want to delete them after a single day if, i.e., another batch of 5 versions comes through.
Expected Behavior
The Console seems to allow exactly what I'm going after:

Current Behavior
Currently, the option for how many noncurrent versions to retain
noncurrentVersionsToRetainis under thenoncurrentVersionTransitionsconfiguration option, which forces to specifytransitionAfterandstorageClass. The Console UI (see above) suggests that I would not need to specify these and only need specifynoncurrentVersionExpiration.Reproduction Steps
Here is the Object I'm trying to create with the
noncurrentVersionTransitionsconfig option commented out:Possible Solution
Judging by the UI, it looks like
noncurrentVersionsToRetainshould be a property of the Lifecycle rule and not nested intononcurrentVersionTransitions.Additional Information/Context
No response
CDK CLI Version
2.19.0 (build e0d3e62)
Framework Version
aws-cdk-lib@2.8.0
Node.js Version
v16.13.2
OS
Ubuntu 20.04
Language
Typescript
Language Version
No response
Other information
No response