rails-lambda / lamby

🐑🛤 Simple Rails & AWS Lambda Integration

Home Page:https://lamby.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EventBridge Guide

metaskills opened this issue · comments

I forgot we built in EventBridge support and need to add some guides around it. Here is the PR outlining the features. #82 We will need docs on permissions and rules. For ex:

EventBridgeRule:
  Type: AWS::Events::Rule
  Properties:
    Description: String
    EventBusName: arn:aws:events:us-east-1:123456789012:event-bus/merchandising
    EventPattern: { "source": [ "myorg.products@StyleUpdate" ], "detail-type": [ "PricingChange" ] }
    Targets:
      - Arn: !GetAtt RailsLambda.Arn
        Id: MyAppProductUpdates
        RetryPolicy:
          MaximumRetryAttempts: 10
          MaximumEventAgeInSeconds: 400

EventBridgeLambdaPermission:
  Type: AWS::Lambda::Permission
  Properties:
    FunctionName:
      Ref: "RailsLambda"
    Action: "lambda:InvokeFunction"
    Principal: "events.amazonaws.com"
    SourceArn: !GetAtt EventBridgeRule.Arn

It might be cool to explore a few handler alternative steps. Like maybe promote a single PORO. Maybe the Lamby interface could include some source interface patterns.