The objective of this step is to connect the StateLambda
function with the IncomingDataStream
Kinesis stream as shown in the diagram below. When new messages become available in the Kinesis stream, the StateLambda
function will be invoked to process the stream records. Each stream record contains a single trade.
StateLambda
function to edit its configuration. See the figure below.StateLambda
function doesn’t have any triggers yet. Click on the Add trigger
button.Kinesis
as the data source.IncomingDataStream
.Batch size
to 100
.Add
in the bottom right corner to create and enable an event source mapping on the Lambda function.At this point you have configured an event based connection between Kinesis Data Streams and AWS Lambda. The StateLambda
function will be invoked whenever new messages appear in the IncomingDataStream
. The messages will be passed to the Lambda function in batches of up to 100 at a time.
If everything was done correctly then the StateLambda
function will be invoked with stream records from the Kinesis stream. Therefore, in one to two minutes you should be able to see logs from the Lambda invocations under the Monitor
in the Logs
tab.
You can also observe the outputs of StateLambda
to verify the connection by reviewing the Items
section of the DynamoDB console. To do that, navigate to the DynamoDB service in the AWS console, click Items
on the left, and select StateTable
.
At this stage you should see multiple rows similar to the image below. The number of items returned may vary. You can click on the orange Run
button if you want to refresh the items.
Continue on to: Step 2.