SNS 主题说它需要一个字符串

SNS Topic says it wants a string

我浏览了几个指南,它们都遵循相同的模式,但我仍然收到以下错误:

An error occurred: IngestSNSTopic - Value of property Endpoint must be of type String.

此处使用无服务器框架是声明该资源的部分。我已经反复研究了几个小时了,希望得到一些帮助,谢谢。

    IngestSNSTopic:
      Type: AWS::SNS::Topic
      Properties:
        Subscription:
          -
            Endpoint:
              Fn::GetAtt:
                - IngestQueue
                - Arn
              Protocol: sqs
    IngestQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: ${opt:stage}-mam-ingest-queue-${file(env/${opt:stage, 'dev'}.yml):IP_SLUG}
        RedrivePolicy:
          maxReceiveCount: 3
          deadLetterTargetArn:
            Fn::GetAtt:
              - IngestDeadLetter
              - Arn

我认为 AWS docs are actually incorrect、JSON 和 YAML 示例的输出不同。 Protocol 属性 缩进一次太多,这意味着 Endpoint 将被评估为一个对象。

这是您的配置在 JSON 中的计算结果:

{
    "IngestSNSTopic": {
        "Type": "AWS::SNS::Topic",
        "Properties": {
            "Subscription": [
                {
                    "Endpoint": {
                        "Fn::GetAtt": [
                            "IngestQueue",
                            "Arn"
                        ],
                        "Protocol": "sqs"
                    }
                }
            ]
        }
    }
}

我认为应该是这样的:

    IngestSNSTopic:
      Type: AWS::SNS::Topic
      Properties:
        Subscription:
          -
            Endpoint:
              Fn::GetAtt:
                - IngestQueue
                - Arn
            Protocol: sqs