Following policy states to delete the current version of an object after 30 days and previous version after 30 days.
Now suppose I upload an object on 1st April in a version enabled bucket and then upload same object on 10th April.
If I had not uploaded second version, current object would have got deleted on 30th April.
So my question is what would happen in case I have uploaded second version on 10th april.
Would new version and old version be deleted both on 10th May OR, old version gets deleted on 30th April and new version get's deleted on 10th May?
{
"Rules": [{
"ID": "DeletionOfFileBasedOnQATag",
"Status": "Enabled",
"Expiration": {
"Days": 30
},
"NoncurrentVersionExpiration": {
"NoncurrentDays": 30
}
}
]
}
Based on the excerpts below from AWS Docs, in the current case, both objects (latest version and previous version) will get deleted on 10th May
Current version will expire on 10th May, since it's created on 10th April (we have expiration = 30days)
Noncurrent version will expire on 10th May, since it's also created=modified on 10th April (and we have non-current-expiration = 30days)
Amazon S3 maintains only the last modified date for each object. For example, the Amazon S3 console shows the Last Modified date in the object Properties pane. When you initially create a new object, this date reflects the date the object is created. If you replace the object, the date changes accordingly. So when we use the term creation date, it is synonymous with the term last modified date. ref:https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#intro-lifecycle-rules-number-of-days
NoncurrentVersionExpiration action element – Use this action to specify how long (from the time the objects became noncurrent) you want to retain noncurrent object versions before Amazon S3 permanently removes them. The deleted object can't be recovered.
This delayed removal of noncurrent objects can be helpful when you need to correct any accidental deletes or overwrites. For example, you can configure an expiration rule to delete noncurrent versions five days after they become noncurrent. For example, suppose that on 1/1/2014 10:30 AM UTC, you create an object called photo.gif (version ID 111111). On 1/2/2014 11:30 AM UTC, you accidentally delete photo.gif (version ID 111111), which creates a delete marker with a new version ID (such as version ID 4857693). You now have five days to recover the original version of photo.gif (version ID 111111) before the deletion is permanent. On 1/8/2014 00:00 UTC, the Lifecycle rule for expiration executes and permanently deletes photo.gif (version ID 111111), five days after it became a noncurrent version. https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#intro-lifecycle-rules-actions