How to deploy aws EventBridge with CDK – Python example

Question:

I need some aws EventBridge CDK deployment- Python example ?

Did anyone has some code ?

Answer:

The following example is a well working Python CDK code.

The example demonstrates how to deploy an AWS EventBridge that simultaneously triggers a Step Function and a Lambda Function using AWS CDK (Cloud Deployment Kit).

by yl.

Pre-requisite:

  • Python 3.7
  • AWS CDK

Steps:

1) Deploys a lambda function

2) Prepares resources: EventBus, EventPattern (an EventBridge filter will be explained later on)

3) Creates a Step functions StateMachine

4) Creates rule using resources: EventBus, EventPattern, Targets: Lambda and State-Machine

Note:

on the Lambda function deployment

The _lambda.Code.asset points to the ‘functions’ folder where the lambda code is located
when the folder hierarchy is:

Leave a Reply