AWS: Delete Permanently S3 objects less than 30 days using 'Lifecycle Rule'

感情迁移 提交于 2021-02-10 14:30:58

问题


Is there a way to configure on S3 Lifecycle to delete object less than 30 days (say I want to delete in 5 days Permanently without moving to any other Storage class like glacier? Or should I go by other alternative like Lambda ?

I believe, S3 'Lifecycle Rule' allows storage class only more than 30 days.


回答1:


You can use expiration action:

Define when objects expire. Amazon S3 deletes expired objects on your behalf.

You can set expiration time to 5 days or 1 day, or what suits you. For example, for a version bucket you can delete both current and previous versions after 5 days as shown on the screenshot:

Regarding the storage classes. You can still delete the objects, but you will be charged for 30, 90 or 180 days, depending on the storage class, if not deleting from the Standard class:

If you create an S3 Lifecycle expiration rule that causes objects that have been in S3 Intelligent-Tiering, S3 Standard-IA, or S3 One Zone-IA storage for less than 30 days to expire, you are charged for 30 days. If you create a Lifecycle expiration rule that causes objects that have been in S3 Glacier storage for less than 90 days to expire, you are charged for 90 days. If you create a Lifecycle expiration rule that causes objects that have been in S3 Glacier Deep Archive storage for less than 180 days to expire, you are charged for 180 days.



来源:https://stackoverflow.com/questions/62143832/aws-delete-permanently-s3-objects-less-than-30-days-using-lifecycle-rule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!