0

I have an existing kinesis instance and my aim is to connect to it via a lambda function and process the records.

I created the lambda using vscode aws-toolkit extension by "create new SAM Application". I put some test records using boto3 in python. every time I revoke the lambda locally in the debug mode, the event is an empty object so there are no records to parse.

I can connect to the kinesis and retrieve records in python using boto3 to confirm the existence of the records.

Here is my template.yaml

Globals:
  Function: 
  Timeout: 60

Resources: 
  KinesisRecors: Type: AWS::Serverless::Function
  Properties: 
    CodeUri: kinesis_records/ 
    Handler: app.lambda_handler 
    Runtime: python3.8 
    Events: 
      KinesisEvent: 
        Type: Kinesis 
        Properties: 
          Stream: arn:aws:.... 
          StartingPosition: TRIM_HORIZON 
          BatchSize: 10 
          Enabled: false

I have also tested with Enabled: true with no success

The lamda function

import base64
def lambda_handler(event, context):
    for record in event['Records']:
       payload=base64.b64decode(record["kinesis"]["data"])

Is it possible to invoke the function locally and get records?

4

0 回答 0