

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](https://aws.amazon.com/blogs/machine-learning/maintain-access-and-consider-alternatives-for-amazon-monitron).

# Processing data with Lambda
<a name="data-export-lambda-v2"></a>

**Topics**
+ [Step 1: Create the [IAM role](https://docs.aws.amazon.com//lambda/latest/dg/lambda-intro-execution-role.html) that gives your function permission to access AWS resources](#data-export-lambda-v2-1)
+ [Step 2: Create the Lambda function](#create-lambda-function-v2)
+ [Step 3: Configure the Lambda function](#configure-lambda-function-v2)
+ [Step 4: Enable Kinesis trigger in AWS Lambda console](#configure-kinesis-trigger-v2)

## Step 1: Create the [IAM role](https://docs.aws.amazon.com//lambda/latest/dg/lambda-intro-execution-role.html) that gives your function permission to access AWS resources
<a name="data-export-lambda-v2-1"></a>

1. Open the [roles page](https://console.aws.amazon.com/iam/home?#/roles) in the IAM console.

1. Choose **Create role**.

1. 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.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/lambda-role-1.png)

1. 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.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/lambda-role-2.png)

1. 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.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/lambda-create-role.png)

1. Select **Create role**.

## Step 2: Create the Lambda function
<a name="create-lambda-function-v2"></a>

1. Open the **Functions** page in the Lambda console.

1. Choose **Create function**.

1. Choose **Use a blueprint**.

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

1. Choose **Configure**.  
![Create function page with Use a blueprint option selected and kinesis-process-record-python blueprint shown.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/lambda-create-function.png)

## Step 3: Configure the Lambda function
<a name="configure-lambda-function-v2"></a>

1. Choose **Function name**

1. Choose the role created in the first step as the **Execution role**.

1. Configure Kinesis trigger.

   1. Choose your Kinesis stream.

   1. Click **Create function**.  
![Lambda function configuration form with basic information and Kinesis trigger settings.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/lambda-kinesis-trigger.png)

## Step 4: Enable Kinesis trigger in AWS Lambda console
<a name="configure-kinesis-trigger-v2"></a>

1. On the **Configuration** tab, choose **Triggers**.

1. 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.](http://docs.aws.amazon.com/Monitron/latest/user-guide/images/kinesis-process-record-lambda.png)

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. 