AWS Lifecycle配置Noncurrentversion过渡:参数验证失败

时间:2018-11-15 09:48:38

标签: amazon-web-services lifecycle

我正在使用aws cli在S3存储桶上设置生命周期管理。我正在使用以下json脚本:

{
    "Rules": [
        {
            "Filter": {

            },
            "Status": "Enabled",
            "Transitions": [
        {
            "Days": 30,
            "StorageClass": "STANDARD_IA"
        },
                {
                    "Days": 365,
                    "StorageClass": "GLACIER"
                }
            ],
            "NoncurrentVersionTransitions": {
                "NoncurrentDays":  30,
                "StorageClass": "STANDARD_IA"
                },

            "Expiration": {
                "Days": 3650
            },
            "ID": "Test"
        }
    ]
}

我收到此错误:

Parameter validation failed:
Invalid type for parameter 
LifecycleConfiguration.Rules[0].NoncurrentVersionTransitions, value: 
OrderedDict([(u'NoncurrentDays', 30), (u'StorageClass', u'STANDARD_IA')]), 
type: <class 'collections.OrderedDict'>, valid types: <type 'list'>, <type 
'tuple'>

当我排除有关NoncurrentVersionTransitions的部分时,脚本可以正常工作。我想知道如何正确地包含NoncurrentVersionTransitions。

谢谢。

1 个答案:

答案 0 :(得分:0)

 "NoncurrentVersionTransitions": {
                "NoncurrentDays":  30,
                "StorageClass": "STANDARD_IA"
                },

替换为添加的[]

"NoncurrentVersionTransitions": [{
                    "NoncurrentDays":  30,
                    "StorageClass": "STANDARD_IA"
                    }],

解决了问题。