I have set the following rule in my bucket which deletes all files with prefix “myPrefix”, size bigger than 12345 and older than 7 days:
var ruleFilter = LifecycleRuleFilter.builder().prefix("myPrefix").objectSizeGreaterThan(12345L).build();
var rule =
LifecycleRule.builder()
.id("myId")
.filter(ruleFilter)
.expiration(LifecycleExpiration.builder().days(7).build())
.status(ExpirationStatus.ENABLED)
.build();
My question is, is it possible to have a rule that instead of checking object size checks total prefix size? -> only delete prefixed data that’s 7 days or older, but never delete more than 12345 in size in the whole prefix.
In other words keep exactly the same rule but never go over the 12345 threshold, always keep at least that amount in there.
Alternatively if this is not possible instead of total prefix size, keep a minimum file count in the prefix.
Are any of these rules possible to make in s3 lifecycle management?