0
這樣做(AWS-SDK紅寶石寶石):無法設置桶生命週期配置
s3_client.put_bucket_lifecycle_configuration({
bucket: bucket,
lifecycle_configuration: {
rules: [
{
id: "clean-temporary",
status: "Disabled", # required, accepts Enabled, Disabled
prefix: "temporary",
filter: {
prefix: "temporary",
},
expiration: {
days: 1,
},
},
],
},
})
我得到了一個錯誤:Aws::S3::Errors::BadRequest: [!]
根據發行說明,我的版本(11)支持: 已添加S3存儲桶生命週期API。請注意,目前它只支持對象到期。
我在做什麼錯?
UPD: 試過s3cmd,並沒有幫助:
⇒ s3cmd -c s3cfg setlifecycle lifecycle_configuration.xml s3://my-new-bucket
ERROR: S3 error: 405 (MethodNotAllowed)
⇒ cat lifecycle_configuration.xml
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Rule><ID>test</ID><Status>Enabled</Status><Expiration><Days>1</Days></Expiration><Prefix></Prefix></Rule></LifecycleConfiguration>