3. Configure Lambda

You need to configure a Lambda function to read data from MSK and write it to OpenSearch. To configure the Lambda function

  1. Navigate to the Lambda console
  2. Click on msk-os-lambda

lambda_1

  1. Click on Add trigger

lambda_2

  1. Select MSK from the trigger drop down
  2. Select msk-workshop-cluster from the MSK cluster drop down
  3. Enter 500 for the batch size
  4. Enter 30 for the batch window
  5. Enter ApplicationMetricTopic for the topic name
  6. Select Latest from the starting position drop down
  7. Click on Add

lambda_3

You will automatically be redirected to a page that looks like the one below. Take note of the status of trigger. Remain on this page refreshing as necessary until the trigger status is Enabled

lambda_4

  1. Click on the Code tab
  2. Update the os_url variable with the value of the OSDomainURL key from the CloudFormation stack output

lambda_5

  1. Click on the Deploy button

lambda_6

Our Lambda function is now set up. When you are ready begin the next step Send Logs