Skip to content

Instantly share code, notes, and snippets.

@leegilmorecode
Created October 4, 2021 12:48
Show Gist options
  • Select an option

  • Save leegilmorecode/f162bc9807fec9362782ebb66709b8f0 to your computer and use it in GitHub Desktop.

Select an option

Save leegilmorecode/f162bc9807fec9362782ebb66709b8f0 to your computer and use it in GitHub Desktop.
Example for the team :)
service: serverless-event-bridge
variablesResolutionMode: 20210326
provider:
name: aws
runtime: nodejs14.x
lambdaHashingVersion: 20201221
memorySize: 128
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'eu-west-1'}
eventBridge:
useCloudFormation: true
apiGateway:
shouldStartNameWithService: true
iam:
role:
statements:
- Effect: 'Allow'
Action:
- 'events:*'
Resource:
- 'arn:aws:events:regionhere:accountidhere:event-bus/serverless-event-bridge' # add the region and accountId here
plugins:
- serverless-webpack # you wont need this - I was using typescript
functions:
createOrder:
handler: src/orders/create.handler # this would create an order Ryan via a post on APIG
timeout: 3
events:
- http:
path: orders
method: post
createFulfilment:
handler: src/fulfilment/create.handler
events:
- eventBridge:
eventBus: serverless-event-bridge # this lambda listens to the event with source order.create
pattern:
source:
- order.create
createPayment:
handler: src/payment/create.handler
events:
- eventBridge:
eventBus: serverless-event-bridge # this lambda listens to the event with source order.create
pattern:
source:
- order.create
resources:
Resources:
DLQ:
Type: AWS::SQS::Queue
Properties:
QueueName: serverless-event-bridge-dlq # this will create you a DLQ - hook it up above
custom:
# this is the webpack config for the build # ignore this ryan
webpack:
webpackConfig: 'webpack.config.js'
includeModules:
forceExclude:
- aws-sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment