Using CloudFormation, I want to set some of the properties in AWS::S3::Bucket on an existing bucket. In other words, I don't want to create the bucket, I just want to enforce some of the settings. Here's an example of my CloudFormation JSON:
"websitePreviewBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": "PublicRead",
"VersioningConfiguration": {
"Status": "Suspended"
},
"BucketName": "preview.website.com",
"WebsiteConfiguration": {
"IndexDocument": "index.html",
"ErrorDocument": "error.html"
}
}
},
Not surprisingly, this fails in the CloudFormation console:
The following resource(s) failed to create: [websitePreviewBucket].
preview.website.com already exists
I've created the bucket preview.website.com
. I mean, this account owns that bucket. How can I set things like AccessControl
and WebsiteConfiguration
on an existing bucket with CloudFormation?
I've seen another question asking something similar, but it doesn't have a suitable answer.