You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

EventBridge管道CloudFormation配置InputTemplate报错求助

解决EventBridge Pipe CloudFormation配置中InputTemplate变量报错问题

问题分析

在控制台使用<aws.pipes.event.json>预定义变量可正常解析SQS输入,但CloudFormation配置时触发Invalid json path reference or predefined variable for placeholder number 1错误,核心原因是YAML语法中<和>属于特殊标签字符,直接书写会被CloudFormation错误解析,无法识别为预定义变量。

解决方案

修改CloudFormation中InputTemplate的写法,用引号包裹预定义变量,避免YAML解析干扰:

Pipe:
  Type: AWS::Pipes::Pipe
  Properties:
    Name: some name
    RoleArn: a role
    Source: queue
    SourceParameters: 
      SqsQueueParameters:
        BatchSize: 1
    Target: state machine
    TargetParameters:
      InputTemplate: "<aws.pipes.event.json>"
      StepFunctionStateMachineParameters: 
        InvocationType: FIRE_AND_FORGET

补充说明

  1. 若目标服务(如Step Functions)仅需使用SQS消息的body内容(而非完整SQS事件结构),可将预定义变量替换为<aws.pipes.event.body>:
    InputTemplate: "<aws.pipes.event.body>"
    
  2. 当BatchSize > 1时,如需提取批量消息中的单条数据,可使用JSONPath语法,例如取第一条消息的完整结构:
    InputTemplate: "<aws.pipes.event[0].json>"
    

内容的提问来源于stack exchange,提问作者Josee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 16:42:39