0
我的对象有属性'Expiration': 'expiry-date="Sun, 16 Jul 2017 00:00:00 GMT"'
,它定义何时将删除此对象 - 此日期由生命周期规则中的S3设置。有没有办法从boto3更新这个日期来稍后自动解码这个对象?顺便说一下,我在属性x-amz-expiration
中找到了相同的日期时间。boto3 S3:更新对象上的`expiry-date`
我的对象有属性'Expiration': 'expiry-date="Sun, 16 Jul 2017 00:00:00 GMT"'
,它定义何时将删除此对象 - 此日期由生命周期规则中的S3设置。有没有办法从boto3更新这个日期来稍后自动解码这个对象?顺便说一下,我在属性x-amz-expiration
中找到了相同的日期时间。boto3 S3:更新对象上的`expiry-date`
虽然你的对象可能已经走了,已经有针对特定主题的回答的问题:s3 per object expiry
TL;博士:有效期为每S3斗,而是通过模拟touch
可以延长的个别到期日对象。
当你问一个boto3
- 溶液为和这样的解决方案中的链接问题没有注意,这里是一个与boto3:
#!/usr/bin/env python3
import boto3
client = boto3.client('s3')
# Upload the object initially.
client.put_object(Body='file content',
Bucket='your-bucket',
Key='testfile')
# Replace the object with itself. That will "reset" the expiry timer.
# As S3 only allows that in combination of changing metadata, storage
# class, website redirect location or encryption attributes, simply
# add some metadata.
client.copy_object(CopySource='your-bucket/testfile',
Bucket='your-bucket',
Key='testfile',
Metadata={'foo': 'bar'},
MetadataDirective='REPLACE')