Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Captcha Click on image to update the captcha .


Register Now

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Morbi adipiscing gravdio, sit amet suscipit risus ultrices eu.Fusce viverra neque at purus laoreet consequa.Vivamus vulputate posuere nisl quis consequat.

Create an Amazon Lex Bot Using a Blueprint

Create an Amazon Lex Bot Using a Blueprint

In this exercise, you do the following:

  • Create your first Amazon Lex bot and test it in the Amazon Lex console. For this exercise,

you use the OrderFlowers blueprint.

  • Create an AWS Lambda function and test it in the Lambda console. While processing a

request, your bot calls this Lambda function. For this exercise, you use a Lambda blueprint (lexorder-

flowers-python) provided in the AWS Lambda console to create your Lambda function.

The blueprint code illustrates how you can use the same Lambda function to perform

initialization and validation, and to fulfill the OrderFlowers intent.

  • Update the bot to add the Lambda function as the code hook to fulfill the intent. Test the

end-to-end experience.

Blueprints will have preconfigured tasks for both Chatbot and Lambda



Step 1: Create a Chatbot using Lex console:

  1. Navigate to Lex console.
  2. On the Bots page, select the Create option.
  3. On the Create your Lex bot page, provide the following information and then select the

Create option.

  1. Choose the OrderFlowers blueprint.
  2. Leave the default bot name (OrderFlowers).
  3. For COPPA, select the No option.
  4. Select the Create option. The console makes the necessary requests to Amazon Lex to

save the configuration. The console then displays the bot editor window.

  1. Wait for confirmation that your bot is built and test the bot.


Step 2: Create a Lambda Function (Console)

  1. To create the Lambda function (console), navigate to Lambda service
  2. Select the Create function.
  3. On the Create function page, choose Blueprints. Type lex- in the filter text box to find

the blueprint, choose the lex-order-flowers-python blueprint.

  1. Lambda function blueprints are provided in both Node.js and Python. For this exercise,

use the Python-based blueprint.

  1. On the Basic information page, do the following, and then select the Create function.
  • Type a Lambda function name (OrderFlowersCodeHook).
  • For the IAM role, select the Create a new role from template(s).
  • Type a role name (LexOrderFlowersRole).
  • Leave the other default values.
  1. Select the Create function and test the Lambda function.
  • Choose Select a test events, Configure test event.
  • Choose Lex-Order Flowers from the Event template list. This sample event matches

the Amazon Lex request/response .Give the test event a name


  • Select the Create option.
  • Verify that the Lambda function successfully executed. The response, in this case,

matches the Amazon Lex response model.


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

  1. In the Amazon Lex console, select the OrderFlowers bot. The console shows the

OrderFlowers intent. Make sure that the intent version is set to $LATEST because this is

the only version that we can modify.

  1. Add the Lambda function as the fulfillment code hook and test it.

o In the Editor, choose AWS Lambda function as Fulfillment, and select the Lambda

function that you created in the preceding step (OrderFlowersCodeHook). Select

the OK option to give Amazon Lex permission to invoke the Lambda function.

o You are configuring this Lambda function as a code hook to fulfill the intent.

Amazon Lex invokes this function only after it has all the necessary slot data

from the user to fulfill the intent.

o Specify a Goodbye message.

o Choose Build.

o Test the bot using the previous conversation.

The last statement “Thanks, your order for roses…..” is a response from the Lambda function

that you configured as a code hook. In the preceding section, there was no Lambda function.

Now you are using a Lambda function to actually fulfill the OrderFlowers intent.

  1. Add the Lambda function as an initialization and validation code hook, and test.


The sample Lambda function code that you are using can both perform user input validation

and fulfillment. The input event the Lambda function receives has a field (invocationSource)

that the code uses to determine what portion of the code to execute.

Select the $LATEST version of the OrderFlowers intent. That’s is the only version that you can


  1. In the Editor, choose Initialization and validation in Options.
  2. Again, select the same Lambda function.
  3. Choose Build.
  4. Test the bot.

You are now ready to converse with Amazon Lex. To test the validation portion, choose time 6

PM, and your Lambda function returns a response (“Our business hours are from 10 AM to 5

PM.”), and prompts you again. After you provide all the valid slot data, the Lambda function

fulfills the order.

About Abhay Singh

7 + years of expertise of Cloud Platform(AWS) with Amazon EC2, Amazon S3, Amazon RDS, VPC, IAM, Amazon ELB, Scaling, CloudFront, CDN, CloudWatch, SNS, SQS, SES and other vital AWS services. Understand Infrastructure requirements, and propose design, and setup of the scalable and cost effective applications. Implement cost control strategies yet keeping at par performance. Configure High Availability Hadoop big data ecosystem, Teradata, HP Vertica, HDP, Cloudera on AWS, IBM cloud & other cloud services. Infrastructure Automation using Terraform, Ansible and Horton Cloud Break setups. 2+ Years of development experience with Big Data Hadoop cluster, Hive, Pig, Talend ETL Platforms, Apache Nifi. Familiar with data architecture including data ingestion pipeline design, Hadoop information architecture, data modeling, and data mining, machine learning, and advanced data processing. Experience at optimizing ETL workflows. Good knowledge of database concepts including High Availability, Fault Tolerance, Scalability, System, and Software Architecture, Security and IT infrastructure.

Follow Me

Leave a reply

Captcha Click on image to update the captcha .

By commenting, you agree to the Terms of Service and Privacy Policy.