问题描述
其他资源(例如 EC2)可以正常创建,但无法创建 PublicRead s3 存储桶。
Resources:
MyS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: helloworldwebsite
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
命令是:
aws cloudformation create-stack --stack-name myteststack --template-body "file:///path/to/S3-template.yaml"
这是 CloudFormation / Stacks 的屏幕截图:
解决方法
您的模板是正确的。唯一可能的问题是存储桶名称 helloworldwebsite
已经存在。存储分区名称在所有区域和帐户中必须全球唯一。因此,请将 BucketName
更改为新的内容,例如:
Resources:
MyS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: helloworldwebsite222232111
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html