Skip to main content
Welcome back — Michael Forrester here. In this lesson we review Amazon Polly, the managed AWS service for converting text into natural-sounding speech. Polly provides production-ready text-to-speech (TTS) capabilities with support for SSML, custom lexicons, neural voices, streaming or file-based output, and easy integration with other AWS services for voice-enabled workflows. Consider a simple interaction: a user asks about the weather, your backend determines the answer (for example, by querying a weather API), and Polly converts that textual reply into spoken audio for playback.
A simple diagram showing a human icon on the left asking "Hey, tell me about weather" and a robot icon on the right replying with a weather report in speech bubbles. Audio waveform icons and the label "Polly" appear as part of the illustration.

How Amazon Polly works — high level

  • Input: plain text or SSML-enhanced text.
  • Polly synthesizes the text using managed models (including neural voices) and returns audio output.
  • Output can be streamed in real time to a client or written as an audio file (MP3, OGG, PCM) to persistent storage such as S3.
Key capabilities:
  • Text-to-speech with multiple voices, including neural voices for more natural prosody.
  • Real-time streaming and file generation (store results to Amazon S3).
  • SSML support to control pronunciation, pauses, pitch, and speaking rate.
  • Custom lexicons for domain-specific pronunciations.
  • Seamless integration with AWS Lambda, S3, IoT Core, Transcribe, and other services.

Typical S3 + Lambda + Polly architecture

A common, production-friendly pattern is:
  1. Upload an input text file or transcript to an input S3 bucket.
  2. S3 event notifications trigger an AWS Lambda function.
  3. The Lambda function calls Polly to synthesize speech.
  4. Lambda writes the generated audio to an output S3 bucket for playback or distribution.
This flow decouples ingestion, processing, and delivery, and is useful for batch or event-driven TTS generation.
A flow diagram titled "Polly" showing a text file uploaded to an Input S3 bucket that triggers an AWS Lambda function, which sends the text to Amazon Polly for text-to-speech. The resulting audio is then saved to an Output S3 bucket.

Voice-enabled devices: Transcribe + Lambda + IoT + Polly

For voice-driven devices (smart speakers, thermostats, IVR), Polly typically pairs with Amazon Transcribe. A common conversational workflow:
  1. User speaks to the device.
  2. Amazon Transcribe performs speech-to-text.
  3. An AWS Lambda function interprets the text and interacts with device control (for example via AWS IoT Core / MQTT).
  4. The system composes a textual response (e.g., “The temperature is now set to 22°C”).
  5. Amazon Polly converts that text response to spoken audio and returns/stores the audio for playback.
This demonstrates how Transcribe handles the voice-to-text side while Polly handles text-to-voice output.
A diagram of a voice-controlled smart thermostat workflow using AWS services. It shows user speech going to Amazon Transcribe, processed by AWS Lambda and AWS IoT Core to set the thermostat, with Amazon Polly generating the spoken response.
Remember: Amazon Transcribe = voice-to-text. Amazon Polly = text-to-voice. Use both when you need conversational voice interactions that require understanding and spoken responses.

Key features and configuration

Quick examples

AWS CLI — synthesize a short phrase and save as MP3:
SSML example — control speech rate and add a pause:
Using SSML and lexicons lets you tune pronunciation and expressiveness for audiobooks, announcements, or virtual assistants.

When to use Amazon Polly

  • Interactive voice assistants and chatbots that require spoken responses.
  • IVR and telephony systems where synthesized prompts and responses are needed.
  • Bulk generation of audio content such as podcasts, audiobooks, or announcements.
  • Devices or applications requiring low-latency streaming speech output.
  • Scenarios needing precise control over pronunciation using SSML or lexicons.

Example decision table: Polly vs Transcribe

Integration patterns and best practices

  • Use S3 + Lambda as a durable, event-driven pipeline for TTS generation.
  • Prefer neural voices when naturalness is important — test cost vs quality.
  • Use SSML and custom lexicons to improve pronunciation for domain-specific words.
  • For interactive devices, stream audio from Polly to minimize end-to-end latency.
  • Secure access with IAM roles and apply least privilege for Lambda and S3 actions.
If you have any questions, catch us at kodekloud.slack.com. — Michael Forrester

Watch Video