Amazon Lex
Building chatbots and voice assistants on AWS: bots, intents, utterances, slots, and fulfillment with Lambda, versions and aliases, deployment to web, mobile, messaging, and contact centers, the end of Lex V1, security, cost, and how Lex combines with other AI services.
4 min read · Last reviewed · SAA-C03
Sign in to bookmark tutorials and track what you have read.
On this page
What it is
Amazon Lex is a service for building conversational interfaces, chatbots and voice assistants, using voice and text. It combines automatic speech recognition (ASR), to turn speech into text, with natural language understanding (NLU), to work out what the user wants. You don't need deep learning expertise: you define what the bot should do, and Lex handles the conversation.
Choose Lex when a question asks for a chatbot, a voice or text assistant, or an interactive voice response (IVR) system that understands what customers say, for example in a contact center.
Versions: the current service is Amazon Lex V2. AWS ended support for Lex V1 on September 15, 2025, and V1 bots had to be migrated to V2.
Concepts
- Bot: performs automated tasks, such as ordering a pizza or booking a hotel. A bot can support one or more languages.
- Intent: an action the user wants to perform, such as
OrderPizzaorCheckOrderStatus. - Utterances: sample phrases that trigger an intent, such as "I'd like to order a pizza".
- Slots: the information the intent needs, such as size and toppings, each with a slot type. Lex prompts the user for any missing slots.
- Fulfillment: what happens once the bot has everything. A Lambda function can validate input and fulfill the request, for example by writing the order to DynamoDB. Lex V2 uses one Lambda function per bot alias per language.
- Versions and aliases: publish a numbered version and point an alias (such as
prod) at it, so you can update the bot safely.
Where bots run
- Your apps: web and mobile apps through the AWS SDK (Software development kit)A set of libraries for a programming language that wraps a service's API and handles details such as signing requests and retrying. AWS SDKs exist for Python (Boto3), JavaScript, Java, Go, and other languages.Glossary entry.
- Messaging platforms: such as Slack and Facebook Messenger.
- Contact centers: as IVR agents on the phone or chat agents, using the Lex streaming API (Application programming interface)A defined way for one program to ask another for data or actions, such as a set of HTTPS requests and responses. Every AWS service is controlled through its API, which the console, the CLI, and the SDKs call for you.Glossary entry, including Amazon Connect, where bots also capture keypad input.
Combining with other services
- Lex includes speech recognition, so a voice bot doesn't need Amazon Transcribe separately. To speak responses, voice bots use Amazon Polly voices.
- Fulfillment code in Lambda can call any AWS service or back end.
- Use Amazon Comprehend on conversation logs for sentiment.
Security, resilience, performance, and cost
Security
- IAM controls who can build and call bots; Lambda functions use their own execution roles.
- Conversation logs can be encrypted with a customer managed KMS key.
- CloudTrail records API calls.
Resilience and performance
- Lex is a managed, Regional service that scales with the number of conversations.
Cost
- Pay per request: each speech or text request processed, with streaming conversations priced by time interval. There are no upfront costs.
Monitoring
- CloudWatch metrics for bot requests and errors.
- Conversation logs store text in CloudWatch Logs and audio in S3, so you can see what users said and improve the bot.
Lex or another option?
| If the requirement is | Choose |
|---|---|
| Chatbot or voice assistant that understands intent | Amazon Lex |
| IVR for a contact center | Amazon Lex with Amazon Connect |
| Convert recorded calls to text | Amazon Transcribe |
| Read text aloud in a natural voice | Amazon Polly |
| Analyze the sentiment of chat logs | Amazon Comprehend |
Reverse mindmap: when the question points here
- Yes, when the question says
- Build a chatbot for web or mobile leads to Lex
- Voice assistant that understands requests leads to Lex
- IVR in a contact center leads to Lex with Amazon Connect
- Same conversational tech as voice assistants leads to Lex ASR and NLU
- Build the bot
- What the user wants to do leads to Intent
- Phrases that trigger it leads to Utterances
- Information to collect leads to Slots
- Validate and complete the request leads to Lambda fulfillment
- Safe updates leads to Versions and aliases
- No, when the question says
- Only speech to text leads to Transcribe
- Only text to speech leads to Polly
Key takeaways
- Lex builds chatbots and voice assistants with built-in speech recognition and natural language understanding.
- Bots have intents, triggered by utterances, that collect slots and are fulfilled, often by Lambda.
- Deploy bots in apps, messaging platforms, and contact centers such as Amazon Connect.
- Lex V2 is current; Lex V1 support ended on September 15, 2025.
- Pay per request; conversation logs and CloudWatch help improve the bot.
Sources
- Amazon Lex V2 Developer Guide: What is Amazon Lex V2?
- Amazon Lex V2 Developer Guide: Amazon Lex V2 core concepts
- Amazon Lex V2 Developer Guide: Integrating an AWS Lambda function into your bot
- Amazon Lex V2 Developer Guide: Integrating an Amazon Lex V2 bot with a contact center
- Amazon Lex V2 Developer Guide: Amazon Lex V1 to V2 migration guide
- Amazon Connect Administrator Guide: Add an Amazon Lex bot
- Amazon Lex V2 Developer Guide: Logging conversations with conversation logs
- Amazon Lex V2 Developer Guide: Measuring operational metrics with Amazon CloudWatch
- Amazon Lex V2 Developer Guide: Viewing events with AWS CloudTrail
- Amazon Lex pricing