# Deploy EventBridge rule with function

**URL:** <https://forum.serverless.com/t/deploy-eventbridge-rule-with-function/11202>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [April 20, 2020, 3:50pm UTC](https://forum.serverless.com/t/deploy-eventbridge-rule-with-function/11202 "2020-04-20T15:50:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![levi.will](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/levi.will/32/4168_2.png) [@levi.will](https://forum.serverless.com/u/levi.will)\
**Post date:** [April 20, 2020, 3:50pm UTC](https://forum.serverless.com/t/deploy-eventbridge-rule-with-function/11202/1 "2020-04-20T15:50:48Z")

</div>

I’m trying to use serverless to deploy an AWS lambda function and EventBridge rule,  
following the [documentation here](https://serverless.com/framework/docs/providers/aws/events/event-bridge#setting-up-event-pattern-matching).

The function deploys, but does not create an event rule. Is this a problem with my syntax, with serverless, or the documentation?

I can define and deploy similar rules via cloudformation, but would prefer to use the pattern described in the docs because it seems cleaner when you have many rules that each call only one function.

```
functions:
  event-user-registeredSuccessfully:
    handler: src/handlers/userRegisteredSuccessfully
    events:
      - eventBridge:
        pattern:
          detail-type:
            - user.registeredSuccessfully
          source:
            - accounts-api

```

Any ideas or suggestions?

---

<div class="post-metadata">

**Author:** ![levi.will](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/levi.will/32/4168_2.png) [@levi.will](https://forum.serverless.com/u/levi.will)\
**Post date:** [April 21, 2020, 10:58pm UTC](https://forum.serverless.com/t/deploy-eventbridge-rule-with-function/11202/2 "2020-04-21T22:58:31Z")

</div>

I went back to the docs and noticed everything after eventBridge needed an extra indent, otherwise there are no warnings/errors, but the rule is not created.

```
- eventBridge:
  pattern: # silent error
    pattern: # works
```

---

<div class="post-metadata">

**Author:** ![4fthawaiian](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/4fthawaiian/32/4282_2.png) [@4fthawaiian](https://forum.serverless.com/u/4fthawaiian)\
**Post date:** [May 27, 2020, 6:06am UTC](https://forum.serverless.com/t/deploy-eventbridge-rule-with-function/11202/4 "2020-05-27T06:06:57Z")

</div>

Wow. That was random and arbitrary. Thanks for putting this here \<3
