How it works...

In summary, we did the following in this recipe:

  1. Created a lambda that can be invoked when records are added to a Kinesis stream.
  2. Added an event source mapping for invoking the lambda when records are added to a Kinesis stream.
  3. Checked the CloudWatch logs. We will learn more about CloudWatch in the next chapter.

Event source mapping creates a mapping between an event source and an AWS lambda function. The lambda's handler function is then triggered by events on the event source. In our case, we created an event source mapping for our Lambda with a Kinesis event type.

The following are the three event source types that are currently supported:

  • Amazon Kinesis
  • Amazon SQS
  • Amazon DynamoDB

We create all lambda triggers in a similar way to how we did it from UI. However, from CLI, we do this differently for different services. For example, Kinesis, SQS, and DynamoDB triggers are added using event source mapping, but for services such as API Gateway and Alexa Skills, triggers are defined when we use the add-permission subcommand of the lambda CLI command to add a permission policy, and for SNS, the lambda function is subscribed to the SNS topic using the aws sns subscribe command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.249.174