amazon-s3 - 每个对象到期 s3

标签 amazon-s3

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

Java SDK 似乎表明这是可能的,因为它有一个 setExpirationTime方法,但是每当我使用此方法设置到期日期时,似乎什么都没有发生并且对象永远不会过期。此外,通过 aws 控制台查看对象属性,似乎没有设置到期时间。

不支持每个文件到期吗?/是否需要执行任何额外步骤才能使其正常工作?/如果不支持按文件过期,是否可以排除与过期前缀匹配的文件过期?

提前致谢!

最佳答案

它看起来不像 per- object expiration支持,而是每个存储桶生命周期配置,每个配置最多 100 条规则,如您所见。

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

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.



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


看起来您也不能重叠规则。

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.

关于amazon-s3 - 每个对象到期 s3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12185879/

相关文章:

amazon-web-services - 我应该每次都运行 Glue 爬虫来获取最新数据吗?

amazon-web-services - 允许 CloudFront 访问 S3 源,同时还具有 S3 存储桶 阻止所有公共(public)访问?

c# - 将 Amazon S3 Nuget 包含在 Xamarin Android 应用程序中会导致 FileNotFoundException

ios - 将图像和视频上传到亚马逊 S3(arm64 错误)

python - 无法实例化 boto3 S3Transfer 类

amazon-web-services - 在 CloudFormation 中检测到存储桶的 S3 存储桶策略不正确

iphone - iPhone 应用程序与亚马逊 Web 服务后端的架构

node.js - 如何高效地将 Postgres 数据从 Query 传输到 S3

javascript - 通过亚马逊S3的间接ajax请求

amazon-s3 - 使用 ls 和通配符检查文件是否存在于 s3