Object deletion from a non version bucket

0

Hi Team,

I am facing some issue with my bucket object I have a requirement of deletion of objects with lifecycle or with object policy.

My requirement I have 10 folders in my bucket in that each folder again I have 2 folder in that each folder we have multiple objects so I want to keep only 2 latest object and delete all objects and I don't want to delete folders

Non-version bucket with individual objects Please help me to solve this puzzle

1 個回答
0
已接受的答案

I don't believe that you can maintain a number of 'latest' versions using a lifecycle rule unless you are using a bucket versioning. I think the solution may be to use a Lambda function to review the files in your bucket and to remove the ones you don't need. This function could be scheduled as frequently as needed, or on PUT events using EventBridge.

AWS
Alex_K
已回答 2 年前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南