首页 > 解决方案 > S3 错误:使用嵌套堆栈部署 CFN 模板时访问被拒绝

问题描述

我正在尝试启动一个 CFN 模板化的嵌套堆栈。子堆栈与我试图通过 CFN 控制台启动的父堆栈位于同一区域的存储桶中。

我具有管理员访问权限,并且能够通过单个 CFN 模板创建资源,但由于某种原因,使用嵌套堆栈时会返回以下错误:

The following resource(s) failed to create: [My-Sns-Stack]. . Rollback requested by user.
My-Sns-Stack    CREATE_FAILED   S3 error: Access Denied For more information check http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

我检查了以下资源,但没有解决问题:

部署 cloudformation 模板时指定 S3 存储桶

https://www.reddit.com/r/aws/comments/bjk3qw/cloudformation_nested_stacks_s3_access/

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html

...
    Resources:
        SnsStack:
            Type: AWS::CloudFormation::Stack
            Properties:
                TemplateURL: !Ref SnsStackUrl
                TimeoutInMinutes: 15
...

标签: amazon-web-servicesamazon-s3amazon-cloudformation

解决方案


我发现这个错误不太有用,因为我认为 CloudFormation 模板无法访问其中引用的 S3 资源。结果它更简单,“拒绝访问”错误实际上表明 S3 文件包含我的 CloudFormation找不到模板。在对我的嵌套 CloudFormation 堆栈的引用中,TemplateURL: 有一个错字。


推荐阅读