2

我的 SAM template.yml 中有以下资源:

MetricsRule:
  Type: AWS::Events::Rule
  Properties:
    Name: MetricsRule
    Description: Puts metrics to the CloudWatch log group
    EventBusName: !FindInMap [LambdaConfig, !Ref stage, eventBusName]
    EventPattern:
      detail:
        status:
          - GENERATED
    State: !FindInMap [LambdaConfig, !Ref stage, eventEnabled]
    Targets:
      - Id: LogGroupTarget
        Arn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:${LogGroup}"
        InputTransformer:
          InputPathsMap:
            customer-id: $.detail.customerId
            destination-type: $.detail.destinationType
            provider-id: $.detail.providerId
          InputTemplate: '"cusId = <customer-id> - <destination-type> for <provider-id>"'

如果我尝试部署此堆栈,则会失败并出现异常Input for target LogGroupTarget is not a valid JSON text.

升级版:

如果我InputTemplate按照'{"message":"cusId = <customer-id> - <destination-type> for <provider-id>"}'它的方式工作。但是,在文档、示例中,甚至在 UI 中的字段占位符中,它都表明Input Template: A string containing placeholders which will be filled with values defined in Input Paths e.g. "The state of Instance <instance> is <state>"

是否有任何选项可以指定InputTemplate为字符串?

谢谢。

4

0 回答 0