Skip to content

Instantly share code, notes, and snippets.

Created November 21, 2022 00:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import json
import boto3
kinesis = boto3.client('kinesis')
def lambda_handler(event, context):
# PutRecord API Example
# ---------------------
# Input
record1 = {"personId": 1}
# API Call
response = kinesis.put_record(
StreamName="TestStream", # - name of your kinesis data stream
Data=json.dumps(record1), # - byte string input
PartitionKey="1") # - used as input to hash function to determine which shard to put the record onto
# optional - ExplicitHashKey='string', - ensures the record you are writing lands on a specific shard
# optional - SequenceNumberForOrdering='string' - ensures records written serially are processed in order
# documentation -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment