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 réponse
0
Réponse acceptée

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
répondu il y a 2 ans
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions