错误403 Forbiden使用boto和python配置s3存储桶的生命周期时

时间:2017-10-08 18:31:33

标签: python amazon-s3 boto lifecycle

我是以编程方式使用boto创建和设置s3存储桶。

我可以创建存储桶,对象..并在对象上写...

我想为bucket配置一个生命周期,但是当我运行下面的代码时,我得到了这个例外:

  

boto.exception.S3ResponseError:S3ResponseError:403禁止使用代码SignatureDoesNotMatch。

lifecycle = Lifecycle()

lifecycle.add_rule(
    'rulename',
     prefix='/',
     status='Enabled',
     expiration=Expiration(days=1)
)

bucket = s3.get_bucket('mybucket')

此调试结果可以帮助回答。

回复:'HTTP / 1.1 403 Forbidden \ r \ n'

标题:x-amz-request-id:tx000000000000000000027-0059db8d59-39289-default

标题:内容长度:196

标题:Accept-Ranges:bytes

header:Content-Type:application / xml

标题:日期:星期一,2017年10月9日14:53:13 GMT

追踪(最近一次呼叫最后一次):

文件“pyth.py”,第28行,

bucket.configure_lifecycle(lifecycle)

文件“/usr/lib/python2.7/site-packages/boto/s3/bucket.py”,第1366行,

configure_lifecycle

response.status, response.reason, body)

boto.exception.S3ResponseError:S3ResponseError:403 Forbidden

SignatureDoesNotMatch

tx000000000000000000027-0059db8d59-39289默认

39289 - 缺省 - 默认

bucket.configure_lifecycle(lifecycle)

1 个答案:

答案 0 :(得分:0)

经过一些研究后我可以说这个错误是由不支持生命周期策略的实际ceph版本(10.2.7 Jowel)引起的

$ ceph --version

ceph版本10.2.7-27.el7cp(e0d2d4f2fac9d95a26486121257255260bbec8d5)