【问题标题】:Error in CloudFormation Stack: Syntax errors in policy. (Service: AmazonIdentityManagement; Status Code: 400;CloudFormation 堆栈中的错误:策略中的语法错误。 (服务:AmazonIdentityManagement;状态代码:400;
【发布时间】:2021-03-03 04:32:53
【问题描述】:

这应该相当简单(我希望如此)。我正在通过无服务器框架使用 CloudFormation 堆栈,但遇到语法错误。该项目正在使用 Lambda 调用 QuickSight API 以实现自动数据摄取。

我得到的错误是:


  Serverless Error ---------------------------------------

  An error occurred: QuickSightPolicy - Syntax errors in policy. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: b2982ca2-7518-4e7d-8258-78240d3a465e; Proxy: null).

带有该策略的 Yaml 文件部分如下

    LambdaAssumeRole:
      Type: AWS::IAM::Role
      Properties:
        AssumeRolePolicyDocument:
          Statement:
          - Action: ['sts:AssumeRole']
            Effect: Allow
            Principal:
              Service:
              - lambda.amazonaws.com
    QuickSightPolicy:
      Type: 'AWS::IAM::Policy'
      Properties:
        PolicyDocument:
          Statement:
          - Action: ['quicksight:*']
            Effect: Allow
            Resorce: '*'
        PolicyName: QuickSightPolicy
        Roles: [!Ref 'LambdaAssumeRole']

我省略了 version 属性,但我认为这不会成为它运行的问题。我不确定还有什么需要更改或导致错误的原因

【问题讨论】:

    标签: amazon-web-services yaml amazon-cloudformation amazon-iam serverless-framework


    【解决方案1】:

    ResorceResource 的拼写错误。建议在编写模板以及自动完成和文档链接时尝试使用 VSCode 中的 CloudFormation Linter 来查看其中的一些内联错误:

    [cfn-lint] E2507: IAM Policy statement missing Resource or NotResource
    [cfn-lint] E2507: IAM Policy statement key Resorce isn't valid
    

    【讨论】:

    • 谢谢你,做到了。也谢谢你的建议。从现在开始,我显然需要这样做。
    猜你喜欢
    • 1970-01-01
    • 2021-09-14
    • 2019-08-18
    • 1970-01-01
    • 2020-11-16
    • 2021-08-29
    • 2019-12-12
    • 1970-01-01
    • 2021-02-06
    相关资源
    最近更新 更多