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 Antwort
0
Akzeptierte Antwort

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
beantwortet vor 2 Jahren
profile picture
EXPERTE
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen