i am using the latest serverless on macos
Operating System: darwin
Node Version: 13.13.0
Framework Version: 1.72.0
Plugin Version: 3.6.13
SDK Version: 2.3.1
Components Version: 2.30.12```
===
here is my serverless.yml file
===
```provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-west-2
iamRoleStatements:
- Effect: Allow
Action: events:PutEvents
Resource: "*"
environment:
serviceName: ${self:service}
stage: ${self:provider.stage}
functions:
hello:
handler: functions/handler.hello
events:
- eventBridge:
eventBus: arn:aws:events:us-west-2:xxxxx:event-bus/order_events_dev
pattern:
source:
- 'aws.ec2'
detail-type:
- 'EC2 Instance State-change Notification'
#schedule: rate(10 minutes)```
====
after i run sls deploy, the generated cloudformation under .serverless directory doesn't include the rule setting and lambda function doesn't have trigger configured with eventbridge. If i switched to "schedule" and comment out pattern/source/detail-type lines, rule is generated properly and lambda has trigger with eventbridge.
I run with "SLS_DEBUG=* sls deploy --Nodeploy", which doesn't report error or exception. It just silently ignore the pattern section.
Appreciate any suggestions on what i missed here. Thanks!
@roadtest, I am running into the same issues, have you had any luck with deployment?
no, i haven’t figured out solution. My temp workaround is creating eventbridge rule resource separately. I consider this could be bug of latest serverless release.
Were you able to wire up the Lambdas using ARNs in the serverless.yml file once that was done?
Although it sounds super trivial, I read about someone having the same problem that solved it by indenting the lines properly in your eventBridge configuration like so:
events:
- eventBridge:
eventBus: arn:aws:events:us-west-2:xxxxx:event-bus/order_events_dev
pattern:
source:
- 'aws.ec2'
detail-type:
- 'EC2 Instance State-change Notification'
3 Likes