2
votes

I am trying to attach a kinesis stream event to lambda function usi cli command but getting exception as :

An error occurred (ValidationException) when calling the CreateEventSourceMapping operation: 1 validation error detected: Value null at 'startingPosition' failed to satisfy constraint: Member must not be null.

My command is :

aws lambda  create-event-source-mapping --event-source-arn arn:aws:kinesis:us-west-2:xxxxxx:stream/lambda-stream --function-name helloworld-divyanayan_lambda --batch-size 100 
2
aws lambda create-event-source-mapping --event-source-arn arn:aws:kinesis:us-west-2:xxxxxx:stream/lambda-stream --function-name helloworld-divyanayan_lambda --batch-size 100 --starting-position Latest. i think it is required field as by default no starting position is set - divyanayan awasthi

2 Answers

1
votes

If Lambda is your consumer for Kinesis streams where you are continuously processing stream data, you use "LATEST" as the starting position.

TRIM_HORIZON will read the oldest untrimmed record in the shard.

0
votes

I got this error for a DynamoDB stream mapping to a Lambda in CloudFormation. As other answer/comment suggests, the problem is the starting position on the Kinesis stream.

The CLI docs do indeed have a flag for --starting-position, and the CloudFormation template does as well.

So, in my case, it was fixed by adding this line to my CFN template:

Type: AWS::Lambda::EventSourceMapping
    Properties: 
      ...
      StartingPosition: 'LATEST'