Amazon web services 无服务器创建SNS策略失败,参数无效

Amazon web services 无服务器创建SNS策略失败,参数无效,amazon-web-services,amazon-sns,serverless,Amazon Web Services,Amazon Sns,Serverless,这里是错误 An error occurred: SNSTopicPolicy - Invalid parameter: Policy Error: null (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 38a567df-2cff-50bf-8f0e-33a91775cc6e). 我找不到一个地方查看日志,告诉我缺少什么参数。?。?我很确定我有所有需要的东西。我正在使用这个

这里是错误

An error occurred: SNSTopicPolicy - Invalid parameter:
Policy Error: null (Service: AmazonSNS; 
Status Code: 400; Error Code: InvalidParameter; 
Request ID: 38a567df-2cff-50bf-8f0e-33a91775cc6e).
我找不到一个地方查看日志,告诉我缺少什么参数。?。?我很确定我有所有需要的东西。我正在使用这个和他们的api页面

SNSTopic:
  Type: AWS::SNS::Topic
  Properties:
    DisplayName: Aura main Topic
    TopicName: ${file(./env.yml):${opt:stage, self:provider.stage}.env.auraSnsTopicName}

SNSTopicPolicy:
  Type: AWS::SNS::TopicPolicy
  Properties:
    PolicyDocument:
      Id: auraAllowSQSsendrobelrobel
      Statement:
        -
          Effect: Allow
          Action:
            - sns: Publish
          Resource: { "Fn::GetAtt":["SQSQueue" ,"Arn"]}
          Principle:
            AWS: "*"
    Topics:
      - { "Ref": "SNSTopic" }


SQSQueue:
  Type: AWS::SQS::Queue
  Properties:
    QueueName: ${file(./env.yml):${opt:stage, self:provider.stage}.env.eeegPagesQueueName}
    RedrivePolicy:
      deadLetterTargetArn: {"Fn::GetAtt" : [ "SQSQueueDLQ", "Arn" ]}
      maxReceiveCount: 2


SQSQueuePolicy:
  Type: AWS::SQS::QueuePolicy
  Properties:
    PolicyDocument:
      Id: allowSNSSourceAndLambdaTrigger
      Statement:
        -
          Effect: Allow
          Action:
            - SQS:ReceiveMessage
            - SQS:SendMessage
            - SQS:ChangeMessageVisibility
            - SQS:ListDeadLetterSourceQueues
            - SQS:GetQueueUrl
            # - lambda:CreateEventSourceMapping
            # - lambda:ListEventSourceMappings
            # - lambda:ListFunction
          Resource: {"Ref": "SNSTopic"}
    Queues:
      - { "Ref": "SQSQueue" }
我有一份SQS政策声明,它运行良好

  Your Environment Information ----------------------------
     OS:                    Mac darwin
     Node Version:           8.12.0
     Serverless Version:     1.32.0

事实证明,拼写很重要,而且不需要AWS子对象。 负责人:*

工作政策如下:

SNSTopicPolicy:
  Type: AWS::SNS::TopicPolicy
  Properties:
    PolicyDocument:
      Statement:
        - Sid: auraAllowSQSPublish
          Effect: Allow
          Principal: "*"
          Action: "sns:Publish"
          Resource:  { "Ref": "SNSTopic" }
    Topics:
      - { "Ref": "SNSTopic" }

这可能是错误的缩进,检查这篇文章的yaml部分和相应的识别:谢谢@alexk缩进是好的。我使用的是无服务器,这是整个文档的一个子集。酷,很高兴你得到了答案。我在将文件从Windows复制到Linux时遇到了问题,缩进被搞砸了,所以我猜是这样的