-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(S3): Cannot specify number of noncurrent versions to retain in LifeCycle rule without transitioning the StorageClass #19784
Comments
Hey @KomaGR, Thank you for reporting this. I apologize for contradicting my previous comment, but after a bit more digging I believe that this would be impossible to implement without a request to the S3 team. In the L1 construct this is represented through a JSON structure that would be submitted to the S3 API, so I looked into the S3 documentation itself and found that retention is always declared through the |
Hi @NGL321, thanks for taking a look at this. I dug a bit deeper in the links you shared and I think there might be more to this. It looks like the L1 construct supports retaining a specific number of versions for both expiration and transition actions: noncurrentVersionExpiration: {
noncurrentDays: 123,
// the properties below are optional
newerNoncurrentVersions: 123, // <- This field
},
noncurrentVersionTransition: {
storageClass: 'storageClass',
transitionInDays: 123,
// the properties below are optional
newerNoncurrentVersions: 123, // <- This field
}, The way I interpret this is that the user can:
The realization that both these support a
(The point is that the above is found two separate times in the doc page.) Setting these two retention numbers separately is possible to do from the Console. In conclusionThe Example with expiration only (what I'm trying to achieve)Since I have done this through the Console as a demonstration, here is what the Lifecycle rule configuration JSON looks like when I set the number of versions to retain not-expired: {
"Rules": [
{
"Expiration": {
"ExpiredObjectDeleteMarker": true
},
"ID": "<redacted>",
"Filter": {
"Prefix": "prefix"
},
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 1,
"NewerNoncurrentVersions": 5
},
"AbortIncompleteMultipartUpload": {
"DaysAfterInitiation": 1
}
}
]
} and here is the interpretation of this from the Console: Example with transition and then expirationHere is what the configuration looks like with both transition and expiration configured (had to increase the days due to STANDARD-IA constraints): {
"Rules": [
{
"Expiration": {
"ExpiredObjectDeleteMarker": true
},
"ID": "<redacted>",
"Filter": {
"Prefix": "prefix"
},
"Status": "Enabled",
"NoncurrentVersionTransitions": [
{
"NoncurrentDays": 30,
"StorageClass": "STANDARD_IA",
"NewerNoncurrentVersions": 5
}
],
"NoncurrentVersionExpiration": {
"NoncurrentDays": 31,
"NewerNoncurrentVersions": 5
},
"AbortIncompleteMultipartUpload": {
"DaysAfterInitiation": 1
}
}
]
} |
We need a PRs welcome. |
…#20348) Fixes #19784 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…aws#20348) Fixes aws#19784 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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 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
noncurrentVersionsToRetain
is under thenoncurrentVersionTransitions
configuration option, which forces to specifytransitionAfter
andstorageClass
. 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
noncurrentVersionTransitions
config option commented out:Possible Solution
Judging by the UI, it looks like
noncurrentVersionsToRetain
should 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
[email protected]
Node.js Version
v16.13.2
OS
Ubuntu 20.04
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: