Menu
Amazon Lex
Developer Guide

Step 3: Create a Lambda function

In this section you create a Lambda function using a blueprint (lex-book-trip-python) provided in the Amazon Lex console. You also test the Lambda function by invoking it using sample event data provided by the console.

This Lambda function is written in Node.js.

  1. Sign in to the AWS Management Console and open the AWS Lambda console at https://console.aws.amazon.com/lambda/.

  2. Choose Create a Lambda function.

  3. On Select blueprint, type lex to find the blueprint, choose the lex-book-trip-python blueprint.

  4. Configure the Lambda function as follows and then choose Create Function.

    • Type a Lambda function name (BookTripCodeHook).

    • For the role, choose Create a new role from template(s) and then type a role name.

    • Leave the other default values.

  5. Test the Lambda function. You invoke the Lambda function twice, using sample data for both booking a car and booking a hotel.

    1. Choose Actions, Configure test event.

    2. Choose Lex-Book Hotel (preview) from the Sample event template list.

      This sample event matches the Amazon Lex request/response model. For more information, see Using Lambda Functions.

    3. Choose Save and test.

    4. Verify that the Lambda function successfully executed. The response in this case matches the Amazon Lex response model.

    5. Repeat the step. This time you choose the Lex-Book Car (preview) from the Sample event template list. The Lambda function processes the car reservation.

Next Step

Step 4: Add the Lambda Function as a Code Hook