Skip to content

Instantly share code, notes, and snippets.

@yyolk yyolk/ forked from alexcasalboni/
Created Jul 4, 2018

What would you like to do?
Bridge Function between Kinesis Streams and Step Functions

Bridge Function between Kinesis Streams and Step Functions

For each record read from the Kinesis Stream, a StepFunction state machine will be executed asynchronously.

Required Environment Variables

  • region: the AWS region where your StepFunction state machine is defined.
  • stateMachineArn: the ARN of the StepFunction state machine you want to execute.


  • You have to add an updated version of boto3 to your deployment package.
  • You will need a longer timeout, depending on the size of your Kinesis Stream batch.
  • You can connect multiple Kinesis Streams to the same Bridge Function, as long as the state machine is the same.
import os, base64, boto3
sf = boto3.client("stepfunctions", os.environ['region'])
def lambda_handler(event, context):
for record in event['Records']:
payload = base64.b64decode(record['kinesis']['data'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.