Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

A simple example using SAM to create two Lambda functions communicating via EventBridge.

Notifications You must be signed in to change notification settings

jbesw/eventbridge-sam-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventBridge Lambda-to-Lambda example

This example SAM application creates two Lambda functions, called invoiceService and orderService. It creates a rule that listens for events and routes to the target, invoiceService.

When the orderService function is invoked, it puts a event onto the EventBridge default event bus. This then invokes the invoiceService target.

Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.

.
├── README.MD                   <-- This instructions file
├── invoiceService              <-- Source code for a lambda function
│   └── app.js                  <-- Main Lambda handler
├── orderService                <-- Source code for a lambda function
│   └── app.js                  <-- Main Lambda handler
│   └── package.json            <-- NodeJS dependencies and scripts
├── template.yaml               <-- SAM template

Requirements

Installation Instructions

  1. Create an AWS account if you do not already have one and login.

  2. From the command line, run:

sam build
sam deploy --guided

During the guided SAM process, choose the AWS Region where you want to install this application, and allow the permissions required to complete the installation.

How it works

When the orderFunction service is executed, it sends an event to the default event bus. This event is evaluated by a event rule created by the application. It then triggers the target Lambda function, invoiceFunction.

The purpose of this application is to show how two separate Lambda functions can interact using an event bus, without direct invocation.

==============================================

Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: MIT-0

About

A simple example using SAM to create two Lambda functions communicating via EventBridge.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published