I am trying to set the Life cycle rule for my existing bucket in aws. Below is the code that I am using:
IAmazonS3 client = new AmazonS3Client(Amazon.RegionEndpoint.USWest1);
LifecycleConfiguration newConfiguration = new LifecycleConfiguration
{
Rules = new List<LifecycleRule>
{
new LifecycleRule
{
Expiration = new LifecycleRuleExpiration { Days = 2 },
}
}
};
PutLifecycleConfigurationRequest putRequest = new PutLifecycleConfigurationRequest
{
BucketName = "test-bucket",
Configuration = newConfiguration
};
client.PutLifecycleConfiguration(putRequest);
when I run the above code, I keep getting an error saying :
Amazon.S3.AmazonS3Exception: 'The XML you provided was not well-formed or did not validate against our published schema'
I am not sure what am I doing wrong. I am very new to aws.
Any help will be higly appreciated.