https://serverless-stack.com/ logo
#sst
Title
# sst
o

Omi Chowdhury

08/28/2021, 5:27 PM
Is there a way to specify input path on an EventBridge Rule? Porting some stuff over from serverless, where it looks like:
Copy code
IndexLedgerLinesRule:
      Type: AWS::Events::Rule
      Properties:
        EventBusName: some=eb
        EventPattern:
          source:
            - some-source
          detail-type:
            - some-detail
        Targets:
          - Id: IndexLedgerLinesQ
            Arn: !GetAtt IndexLedgerLinesQ.Arn
            InputPath: '$.detail'
I saw that SST’s EventBridge overrides targets from the CDK version, which I think supports input paths (although haven’t tracked that down how that works yet)
f

Frank

08/28/2021, 6:12 PM
Copy code
import * as events from "@aws-cdk/aws-events";

new EventBus(this, "Bus", {
  rules: {
    rule1: {
      ruleName: "MyRule",
      eventPattern: { source: ["aws.codebuild"] },
      targets: [
        {
          queue: MySstQueue,
          targetProps: {
            message: events.RuleTargetInput.fromEventPath("$.detail")
          }
        }
      ],
    },
  },
});
@Omi Chowdhury give this a try
o

Omi Chowdhury

08/28/2021, 6:17 PM
Ahh didm’t notice the type of message
2 Views