微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

s3 cloudformation 总是提供回滚并且不创建 s3 存储桶

如何解决s3 cloudformation 总是提供回滚并且不创建 s3 存储桶

其他资源(例如 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 的屏幕截图:

enter image description here

解决方法

您的模板是正确的。唯一可能的问题是存储桶名称 helloworldwebsite 已经存在。存储分区名称在所有区域和帐户中必须全球唯一。因此,请将 BucketName 更改为新的内容,例如:

Resources:
  MyS3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: helloworldwebsite222232111
      AccessControl: PublicRead
      WebsiteConfiguration:
        IndexDocument: index.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。