AWS S3 Lifecycle doesn't apply to non-current version object

0

I want to use S3 Lifecycle to remove non-current version object, here is my configuration 在此輸入圖片描述

Here is my non-current version object,

在此輸入圖片描述

and its lifecycle rule information

在此輸入圖片描述

There is no rule apply to hello.tar. Do I misconfigure the S3 Lifecycle rule?

After a few days testing,
hello.tar was deleted as planned after 1 days, with slightly delay of a few hours. However, The applied rule hadn't been displayed in the Management Configuration section.
The lifecycle rule functioned correctly, but there was an issue with the UI.

Eddie
已提问 9 个月前513 查看次数
1 回答
1
已接受的回答

Hello.
The S3 lifecycle rule will not delete the object exactly at the specified date and time, but rather the object will be added to the queue for deletion.
This means that there will be some delay before the deletion takes place because the deletion is done asynchronously.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-expire-general-considerations.html

Amazon S3 queues the object for removal and removes it asynchronously, permanently removing the object.

profile picture
专家
已回答 9 个月前
profile pictureAWS
专家
已审核 9 个月前
profile picture
专家
Steve_M
已审核 9 个月前
  • I understand that there might be a slight delay in deletion. The object was indeed deleted as scheduled. However, there was no applied rule displayed in the Management Configuration section of that object. It might mislead users. I'm not sure whether objects are applied with lifecycle rule.

  • Thank you for your reply. I have confirmed this in my environment. Perhaps what you can see from the object screen is only the lifecycle rules set in the current version of the action. The description of the "Expiration date" states "The object will be made noncurrent and generate a delete marker on this date.", so the Noncurrent version of the action is not relevant. Therefore, the "Noncurrent versions actions" rule cannot be checked from the S3 object. s3

  • Thanks a lot. I'll accept it as the answer. How can I use aws-sdk to check the remaining days before an object is deleted by a lifecycle rule? Or I have to handle this by myself?

    By the way, I posted the same question on stackoverflow and I'd like to share your response with others there. Are you willing to post your answer on stackoverflow? I'll mark it as the accepted answer. If you don't use stackoverflow, could I forward your answer?

    link: https://stackoverflow.com/questions/76880546/aws-s3-lifecycle-doesnt-apply-to-non-current-version-object

  • How can I use aws-sdk to check the remaining days before an object is deleted by a lifecycle rule? Or I have to handle this by myself?

    I don't think there is any way to check this one, even with the SDK. So I think the only way is to write and create your own program. For example, we could create a program that gets the last modified date of the object in head_object and subtracts it with the number of days set in the lifecycle rule. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/head_object.html

    By the way, I posted the same question on stackoverflow and I'd like to share your response with others there.

    Yes, you are welcome to share.

  • I don't find any info about checking remaining days neither. I'll program it by myself. Thank you for your suggestion and generosity!!!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则