s3每个对象到期 [英] s3 per object expiry

查看:116
本文介绍了s3每个对象到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用给定特定前缀的对象到期规则来使S3存储桶中的对象到期,但是出于我的目的,我想以编程方式为每个对象设置到期日期.

I know how to expire objects in an S3 bucket using object expiration rules given a certain prefix, however for my purposes, I would like to set the expiry date programmatically on a per object basis.

Java SDK似乎表明这是可能的,因为它具有

The Java SDK seems to indicate that this is possible as it has a setExpirationTime method, however whenever I set an expiration Date using this method, nothing seems to happen and the object never expires. Additionally, looking at the object properties through the aws console, no expiry appears to be set.

是否不支持每个文件到期?/我需要做一些额外的步骤才能使其正常工作吗?/如果不支持每个文件的到期时间,是否可以将与到期前缀匹配的文件排除在到期时间之外?

Is per file expiration not supported ? / Are there any extra steps I need to do to get it to work ? / If per file expiration is not supported, is it possible to exclude a file that matches an expiration prefix from being expired ?

提前谢谢!

推荐答案

它看起来不像per-

It doesn't look like per-object expiration is supported, but rather a per-bucket lifecycle configuration with up to 100 rules per configuration, as you have found.

存储桶具有一个生命周期配置.生命周期配置 最多可以有100条规则.

A bucket has one lifecycle configuration. A lifecycle configuration can have up to 100 rules.

生存期值必须是非零的正整数.亚马逊S3 通过添加指定的有效期限来计算有效时间 在对象创建时间的规则和结果四舍五入 时间到第二天午夜UTC.

The lifetime value must be a nonzero positive integer. Amazon S3 calculates expiration time by adding the expiration period specified in the rule to the object creation time and rounding the resulting time to the next day midnight UTC.

如果不支持每个文件的有效期,是否可以排除 匹配过期前缀的文件是否已过期?

If per file expiration is not supported, is it possible to exclude a file that matches an expiration prefix from being expired ?

似乎也不能重叠规则.

注意确保规则不重叠.例如, 以下生命周期配置具有一个规则,该规则将对象设置为 前缀文档"将在30天后过期.配置也 还有另一条规则可以将带有"documents/2011"前缀的对象设置为 365天后过期.在这种情况下,Amazon S3返回错误 消息.

Take care to ensure the rules don't overlap. For example, the following lifecycle configuration has a rule that sets objects with the prefix "documents" to expire after 30 days. The configuration also has another rule that sets objects with the prefix "documents/2011" to expire after 365 days. In this case, Amazon S3 returns an error message.

这篇关于s3每个对象到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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