View a markdown version of this page

Processing data with Lambda - Amazon Monitron

Amazon Monitron is no longer open to new customers. Existing customers can continue to use the service as normal. For capabilities similar to Amazon Monitron, see our blog post.

Processing data with Lambda

Step 1: Create the IAM role that gives your function permission to access AWS resources

  1. Open the roles page in the IAM console.

  2. Choose Create role.

  3. On the Select trusted entity page, do the following:

    • In Trusted entity type, choose AWS service.

    • In Use case, for Service or use case choose Lambda.

    • Choose Next.

      IAM role creation wizard showing AWS service selected as trusted entity type with Lambda use case.
  4. In the Add permissions page, do the following:

    • In Permissions policies, choose AWSLambdaKinesisExecutionRole (and AWSKeyManagementServicePowerUser if the Kinesis stream is encrypted).

    • Leave the configurations in Set permissions boundary as is.

    • Choose Next.

      Add permissions page with AWSLambdaKinesisExecutionRole policy selected from search results.
  5. In the Name, review, and create page, do the following:

    • In Role details, for Role name, enter a name for your role. For example lambda-kinesis-role. You can also choose to add an optional Description.

    • Leave the settings for Step 1: Select trusted entities and Step 2: Add permissions as is. You can choost to add tags in Step 3: Add tags to keep track of your resources.

    Name, review, and create page showing role name, description, trusted entities policy, and permissions.
  6. Select Create role.

Step 2: Create the Lambda function

  1. Open the Functions page in the Lambda console.

  2. Choose Create function.

  3. Choose Use a blueprint.

  4. In the Blueprints search bar, search and choose kinesis-process-record (nodejs) or kinesis-process-record-python.

  5. Choose Configure.

    Create function page with Use a blueprint option selected and kinesis-process-record-python blueprint shown.

Step 3: Configure the Lambda function

  1. Choose Function name

  2. Choose the role created in the first step as the Execution role.

  3. Configure Kinesis trigger.

    1. Choose your Kinesis stream.

    2. Click Create function.

    Lambda function configuration form with basic information and Kinesis trigger settings.

Step 4: Enable Kinesis trigger in AWS Lambda console

  1. On the Configuration tab, choose Triggers.

  2. Check the box next to the name of the Kinesis stream and choose Enable.

    Configuration tab showing Triggers section with Kinesis bugbash trigger and Enable button.

The blueprint used in this example only consumes log data from the selected stream. You can further edit Lambda function code later to complete a more complicated task.