I am trying to read-modify-write an existing life-cycle configuration. So the simpler thing I am staring out with is copying a life-cycle configuration between buckets. From reading through the documentation it should be something like:
aws s3api get-bucket-lifecycle-configuration --bucket source-backup > \
bucket-lifecycle-configuration.json
Here is the file created:
[nuevo:~] more bucket-lifecycle-configuration.json
{
"Rules": [
{
"Status": "Enabled",
"Prefix": "",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 180
},
"Expiration": {},
"ID": "DeleteRevisionsOlderThan180Days"
}
]
}
Then to write this to another bucket it should be something like:
aws s3api put-bucket-lifecycle-configuration --bucket dest-backup \
--cli-input-json file://bucket-lifecycle-configuration.json
or
aws s3api put-bucket-lifecycle-configuration --bucket dest-backup \
--lifecycle-configuration file://bucket-lifecycle-configuration.json
But the first yields the error:
Parameter validation failed:
Unknown parameter in input: "Rules", must be one of: Bucket, LifecycleConfiguration
And the second command doesn't seem to detect it is json since it yields:
A client error (MalformedXML) occurred when calling the PutBucketLifecycleConfiguration
operation: The XML you provided was not well-formed or did not validate against
our published schema
Any hints on what is going wrong. It looks like from the documentation on put-bucket-lifecycle-configuration that this is simply an error... but then again I might just have something mis-configured or be doing something wrong?