7. Kinesis Data Streams & Lambda

Integrate AWS Lambda and Amazon Kinesis Data Streams

The Monitoring Team has identified an issue with the application’s ability to compute the scoreboard and store this data in Amazon DynamoDB. We have recruited our SysAdmin as a double-agent to gather more intelligence from the rebel software developer team. She has come back with the following information:

“The developers may have removed a Kinesis trigger from our Scoreboard Lambda Function. Check to see whether or not the Scoreboard Lambda Function has been properly integrated with Kinesis. If there is no trigger, we will need to add one”.

What are we fixing? Live data from the game is sent to a Kinesis Data Stream. This should trigger a Lambda function that consumes the data in one-second batches from the Kinesis Stream. The Lambda function’s code determines how our application consumes these records. We need to connect the Scoreboard Lambda function to Kinesis.

Hint: Click here to see a diagram of your broken architecture.

Solution guidance

  1. From your AWS Management Console, navigate to the AWS Lambda Console. Make sure you are still in the region you chose at the beginning of this workshop.
  2. Search for a function named <YourEnvironmentName>ScoreboardFn.
  3. Click on the name of the function. This will open the Configuration page for this Lambda function.
  4. Let’s validate the tip we received from our SysAdmin. Expand the Designer section. If your designer shows a button “Add trigger” and the Kinesis service is not listed on the lefthand side (something like the picture below), then our SysAdmin was correct: the Lambda function trigger is missing. Let’s add one now. Image

  5. Click Add trigger.

  6. Under Trigger Configuration, click the Select a trigger dropdown and type Kinesis. Select Kinesis. A section for you to configure the Kinesis trigger will appear.

  7. Configure the Kinesis trigger with the following values:

    • Kinesis stream: Select the Kinesis Data Stream attached to your environment. The name will be in the format <YourEnvironmentName>_InputStream
    • Consumer: No consumer
    • Batch size: 700.
    • Batch window: 1.
    • Starting position: Latest.
    • Enable trigger: Leave this box checked.
  8. Select Add.

If the trigger was configured properly, you will see a message in the Designer confirming that you have added the Kinesis trigger.

Stuck? Click here for a Fast Fix