Skip to content

Instantly share code, notes, and snippets.

@beabetterdevv
Created November 21, 2022 00:31
Embed
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 - https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/kinesis.html#Kinesis.Client.put_record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment