views:

67

answers:

2

I am storing many images in Amazon S3, using a ruby lib (http://amazon.rubyforge.org/)

I don't care the photos older than 1 week, then to free the space in S3 I have to delete those photos.

I know there is a method to delete the object in a certain bucket:

S3Object.delete 'photo-1.jpg', 'photos'

Is there a way to automatically delete the image older than a week ?

If Not exist, I'll write a daemon to do that :-(

Thank you, Alessandro DS

+1  A: 

Unfortunately, Amazon doesn't offer an API for automatic deletion based on a specific set of criteria.

You'll need to write a daemon that goes through all of the photos and and selects just those that meet your criteria, and then delete them one by one.

zach at longtail
+1  A: 

If you have access to a local database, it's easy to simply log each image (you may be doing this already depending on your application), and then you can perform a simple query to retrieve the entire list and delete them each. This is much faster than querying S3 directly, but does require local storage of some kind.

drharris