Created
November 21, 2022 00:31
-
-
Save beabetterdevv/5c72deac69f75b229ba71396d18d0e11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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