执行以下命令时
aws s3api put-bucket-lifecycle --bucket krishna-s3auto --lifecycle-configuration '{"Rules":[{"Status":"Enabled","Prefix":"","Expiration":{"Days":'90'},"AbortIncompleteMultipartUpload":{"DaysAfterInitiation":'7'},"Transitions":[{"Days":'91'},"StorageClass":"STANDARD_IA"}],"ID":"Kittu"}]}'
我收到以下错误
Error parsing parameter '--lifecycle-configuration': Invalid JSON: Expecting ',' delimiter: line 1 column 168 (char 167) JSON received: {"Rules":[{"Status":"Enabled","Prefix":"","Expiration":{"Days":90}, "AbortIncompleteMultipartUpload":{"DaysAfterInitiation":7}, "Transitions":[{"Days":91},"StorageClass":"STANDARD_IA"}],"ID":"Kittu"}]}
答案 0 :(得分:2)
您的JSON格式不正确,并且还出现了诸如'Transitions'关键字之类的错误,而不是'Transition'
以下命令应该可以解决您的问题
aws s3api put-bucket-lifecycle --bucket sas3auto --lifecycle-configuration file://lifecycle.json
以下是您需要放入lifecycle.json文件中的内容
{
"Rules": [
{
"Status": "Enabled",
"Prefix": "",
"Expiration": {
"Days": 90
},
"AbortIncompleteMultipartUpload": {
"DaysAfterInitiation": 7
},
"Transition": {
"Days": 91,
"StorageClass": "STANDARD_IA"
},
"ID": "Kittu"
}
]
}