aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

S3 bucket to keep only 3 new objects

Open itsyosefali opened this issue 3 years ago • 1 comments

Describe the feature

as you see from the title , how can i make my amazon s3 bucket to only keep the newest 3 objects (they don't have the same name so i didn't enable the version) and delete the old ones ?

Ps: any help without using lambda function cus i read that it takes money per request

Use Case

lifecycle

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

CLI version used

Environment details (OS name and version, etc.)

itsyosefali avatar Feb 20 '23 07:02 itsyosefali

Hi @itsyosefali, thanks for reaching out. I'm going to convert this into a discussion, since it is more of a guidance question that is better suited as a discussion.

As mentioned in the bucket limitations documentation, buckets have no limit on the number of objects they can contain. If your objects are to be uploaded on a regular schedule, you could use bucket lifecycles to have older objects be deleted. Otherwise, you're right that you'd have to use Lambda or some other service to automate these deletions. Please let me know if you have any other questions.

RyanFitzSimmonsAK avatar Feb 21 '23 00:02 RyanFitzSimmonsAK