Python boto3 set lificycle on objects

时间:2018-03-09 19:13:41

标签: python amazon-s3

is it possible in python 2/boto3 to set life cycle for each uploaded object, using something similar to the permission setting done below? Note - each one of uploaded objects may have different life cycle, hence, me trying to set those individually.

response = s3.put_object_acl(ACL='public-read', Bucket=bucket_name, Key=filename)

1 个答案:

答案 0 :(得分:1)

不幸的是,这是不可能的,因为没有API可以在单个对象上设置生命周期策略:https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectOps.html

您可以做的是在存储桶上设置生命周期策略,并根据对象前缀和/或对象标记应用规则:https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html