Amazon Lex
Developer Guide

Step 3: Create a Lambda Function (Console)

Create a Lambda function (using the lex-order-flowers-python blueprint) and perform test invocation using sample event data in the AWS Lambda console.

You return to the Amazon Lex console and add the Lambda function as the code hook to fulfill the OrderFlowers intent in the OrderFlowersBot that you created in the preceding section.

To create the Lambda function (console)

  1. Sign in to the AWS Management Console and open the AWS Lambda console at

  2. Choose Create a Lambda function.

  3. On Select blueprint, type lex in the filter text box to find the blueprint, choose the lex-order-flowers-python blueprint.

    Lambda function blueprints are provided in both Node.js and Python. For this exercise, use the Python-based blueprint.

  4. Choose Next on the Configure Triggers page.

  5. On the Configure function page, do the following, and then choose Next.

    • Type a Lambda function name (OrderFlowersCodeHook).

    • For the IAM role, choose Create a new role from template(s).

    • Type a role name.

    • Leave the other default values.

  6. On the Review page, choose Create function.

  7. Test the Lambda function.

    1. Choose Actions, Configure test event.

    2. Choose Lex-Order Flowers (preview) from the Sample event template list. This sample event matches the Amazon Lex request/response model (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.

Next Step

Step 4: Add the Lambda Function as Code Hook (Console)