AWS Step Functions to Amazon EventBridge to AWS Lambda

AWS Step Functions → Amazon EventBridge → AWS Lambda

Creates a Step Functions workflow that publishes events to EventBridge, routing to Lambda.

The SAM template contains all the information to deploy AWS resources(the Lambda functions, the EventBridge and the Step Functions workflow) and also the permission required by these service to communicate.
To test this pattern you need to start the State Machine ProcessOrder from your terminal or from AWS Console Step Function. The state machine will invoke the OrderState Lambda function which will create a OrderCreated object which will be sent to a custom EventBridge Bus and intercepted by an Event Pattern Rule.
The event pattern Rule will invoke the ProcessOrder Lambda function with the EventBridge message as a Payload.
You can see the event in the CloudWatch Logs - Log Group of the ProcessOrder Lambda function.
This is fully functional example implemented in Java 11.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/stepfunctions-eventbridge-lambda-sam-java

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Execute the Step Functions workflow:
aws stepfunctions start-execution --state-machine-arn ENTER_YOUR_STATE_MACHINE_ARN
2. View CloudWatch Logs to see events that Step Functions published to EventBridge:
aws logs tail CLOUDWATCH_LOG_GROUP
3. You see an event that was delivered to the event bus.

Created by:

Razvan Minciuna

Razvan Minciuna

Software Architect.

Follow on LinkedIn