自动删除Amazon S3中早于n天的对象(如何?) [英] Automatically deleting objects older than n days in Amazon S3 (How ?)

查看:289
本文介绍了自动删除Amazon S3中早于n天的对象(如何?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Amazon S3中存储许多图像, 使用ruby lib( http://amazon.rubyforge.org/)

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

我不在乎1周以上的照片,然后要释放S3中的空间,我必须删除这些照片.

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 it does Not exist, I'll have to write a daemon to do that :-(

谢谢

更新:现在可以检查罗伯托的答案了.

UPDATE: now it is possible, check the Roberto's answer.

推荐答案

不幸的是,亚马逊没有提供基于一组特定条件的自动删除API.

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.

这篇关于自动删除Amazon S3中早于n天的对象(如何?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆