O'Reilly logo
live online training icon Live Online training

Building chatbots with AWS

How to write voice applications and chatbots with Amazon Lex and Polly

Terren Peterson

The past few years have seen the release of a new wave of products, such as Amazon's Alexa platform, that harness artificial intelligence (AI) and can be built into existing web and mobile applications. Amazon has recently unbundled the technology that powers Alexa, allowing these services to be used outside of Amazon hardware.

In a two-hour hands-on training, Terren Peterson walks you through using two of these services—Amazon Polly, a service that turns text into lifelike speech in a number of languages, and Amazon Lex, which enables you to build conversational interfaces into any application using voice and text—to quickly and easily build your own chatbot. You'll explore the capabilities of these services, especially when used together, and learn how to leverage them within existing digital applications to create artificial agents.

What you'll learn-and how you can apply it

By the end of this live, online course, you’ll understand:

  • Amazon Polly and Lex fundamentals and how to use them to build an application

And you’ll be able to:

  • Create MP3 files to use in digital applications that are created from Amazon Polly
  • Build an Amazon Lex application that can be integrated into a service like Facebook Messenger

This training course is for you because...

  • You're a software developer who wants to build chatbot applications.


  • A working knowledge of JavaScript
  • A basic understanding of digital audio technologies (e.g., how digital voice recordings are stored in formats like MP3s) and messaging services (e.g., AIM, Facebook Messenger, and Slack)
  • Familiarity with Amazon Alexa

Required materials and setup:

An AWS account (Free tier is fine.)

Recommended preparation:

Learning Node (book)

Build Your Own Alexa Skill (book)

Designing Voice User Interfaces (book)

About your instructor

  • Terren Peterson leads software engineering teams at Capital One. An industry expert in cloud technology, Terren has been recognized as an Alexa Champion by Amazon and won the 2016 Internet of Voice Challenge with his creation of an Alexa-driven baseball pitching machine. He has published more than a dozen Alexa skills, including Scavenger Hunt, Music Teacher, Hurricane Center, and Seventh Inning Stretch. Terren is an AWS Certified Solutions Architect and Developer.


The timeframes are only estimates and may vary according to how the class is progressing

Amazon architecture for Alexa and chatbots (40 minutes)

  • Lecture: An overview of the services that make up the Alexa platform and how to utilize them to create other applications; Amazon Lex and Amazon Polly; AWS Lambda and IAM; commonly used terms in AI and chatbot application development
  • Hands-on demonstration: Walk through the components and source code of an existing chatbot application and tie together the architecture with the different services within AWS
  • Q&A

Break (5 minutes)

Creating voice recordings with Polly (10 minutes)

  • Lecture and demonstration: What inputs are needed to create MP3 recordings with various voices within the Polly service using the AWS console

Creating a basic chatbot with Lex (10 minutes)

  • Lecture and demonstration: Creating a chatbot—establishing intents, utterances, and slots within the AWS console

Creating an API that can be called by Lex for backend processing (10 minutes)

  • Lecture and demonstration: Creating a lambda function within AWS that can be addressed by the Lex chatbot

Q&A (10 minutes)

Break (5 minutes)

Assembling services to create a working application (20 minutes)

  • Hands-on exercise: Build your own chatbot using the skills and techniques you learned
  • Wrap-up and Q&A (10 minutes)