Speech Synthesis on AWS: Integrating Amazon Polly with Python and SSML

When integrating a voice assistant on AWS, many clients face a common problem: standard Amazon Polly speech synthesis for Russian sounds unnatural. Neural TTS for ru-RU is not supported, and using Western accents is not an option. Additionally, there is a text length limit — when synthesizing via `s

AI Development Areas

Frequently Asked Questions

העבודות האחרונות

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1441
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1301
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    998
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1264
  • image_logo-advance_0.webp
    B2B Advance company logo design
    713
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1003

When integrating a voice assistant on AWS, many clients face a common problem: standard Amazon Polly speech synthesis for Russian sounds unnatural. Neural TTS for ru-RU is not supported, and using Western accents is not an option. Additionally, there is a text length limit — when synthesizing via synthesize_speech, you can pass a maximum of 1500 characters. We solve these challenges using SSML markup, asynchronous processing via Lambda and S3, and custom prosody settings. Over 5 years of work we have implemented more than 50 TTS cloud projects, each with its own nuances.

How to bypass the Neural limitation for Russian speech?

The main tool is SSML (Speech Synthesis Markup Language). It allows you to control pauses, tempo, stress, and even pronunciation of individual characters. For example, if you need digits to be read individually, use <say-as interpret-as="digits">. To create natural pauses, use <break time="300ms"/>. Here is a production-ready markup example we use:

<speak> Здравствуйте! Ваш заказ <break time="300ms"/> номер <say-as interpret-as="digits">12345</say-as> готов. <prosody rate="slow">Пожалуйста, проверьте данные.</prosody> </speak> 

This brings the sound closer to human-like even on standard voices. According to AWS documentation, SSML corrects intonation better than simply changing voice parameters. Two voices are available for Russian:

Voice Language Type Sample Rate
Maxim ru-RU Standard 8000-22050
Tatyana ru-RU Standard 8000-22050

For comparison, Azure Neural TTS supports Russian, but its cost is roughly 2–3 times higher for the same volume. Amazon Polly with SSML delivers 80% of Azure's quality at a lower price.

Why choose integration via Lambda and S3?

We use the Lambda + S3 combination for scalable and cost-effective synchronization. The client sends text — the Lambda function synthesizes speech via boto3 and saves the file to S3. The user receives a Presigned URL for direct download. For long texts, we launch an asynchronous start_speech_synthesis_task — this saves resources and avoids Lambda's time limits.

import boto3 polly = boto3.client('polly', region_name='us-east-1') def synthesize_speech(text: str) -> bytes: response = polly.synthesize_speech( Text=text, OutputFormat='mp3', # mp3 | ogg_vorbis | pcm | json VoiceId='Tatyana', # Maxim | Tatyana for ru-RU LanguageCode='ru-RU', Engine='standard', # standard | neural (not for ru-RU) SampleRate='22050', # 8000 | 16000 | 22050 TextType='text', # text | ssml ) return response['AudioStream'].read() # SSML synthesis ssml_text = """ <speak> Здравствуйте! Ваш заказ <break time="300ms"/> номер <say-as interpret-as="digits">12345</say-as> готов. </speak> """ response = polly.synthesize_speech( Text=ssml_text, TextType='ssml', OutputFormat='mp3', VoiceId='Tatyana', ) 

For long texts:

# For long texts — async task to S3 response = polly.start_speech_synthesis_task( Text=long_text, OutputFormat='mp3', VoiceId='Tatyana', OutputS3BucketName='my-tts-bucket', OutputS3KeyPrefix='audio/' ) task_id = response['SynthesisTask']['TaskId'] 

How SSML helps in practice: a case with educational video lectures

In one project — voicing educational video lectures — we used custom SSML templates to improve number and formula intelligibility by 30% without using Neural voices. We configured pronunciation for special characters: <say-as interpret-as="digits"> for numbers, <phoneme alphabet="ipa" ph="pi">π</phoneme> for Greek letters, and <prosody rate="85%"> for slow reading of complex terms. This kept costs low (standard synthesis) while achieving high perceptual quality.

What is SSML: key elements for speech synthesis

Tag Purpose Example
<break> Pause in milliseconds <break time="500ms"/>
<say-as interpret-as="digits"> Read digits sequentially номер <say-as interpret-as="digits">123</say-as>
<prosody rate="..."> Control speech rate <prosody rate="slow">important text</prosody>
<phoneme alphabet="ipa" ph="..."> Phonetic pronunciation <phoneme alphabet="ipa" ph="dʒɪˈrɑːf">giraffe</phoneme>
<emphasis level="moderate"> Emphasize a word <emphasis level="moderate">attention</emphasis>

These tags help overcome standard voice limitations and make speech more natural.

What's included in Amazon Polly integration work

  • Complete integration code with boto3, including SSML templates
  • Documentation on architecture and API call
  • Cost optimization recommendations based on your volume
  • Test synthesis on your data for quality assessment
  • Team training (1 hour online) on SSML basics and working with Polly
  • 2 weeks of post-release support for prompt issue resolution

Work process

  1. Analysis: we examine your scenario — text volume, required languages, quality requirements.
  2. Architecture: we design the scheme — Polly + S3 + Lambda + CloudFront (optional).
  3. Implementation: we write Python code with boto3, configure SSML for your texts.
  4. Testing: we run on real data, measure p99 latency.
  5. Deployment: we deploy to your AWS account, grant access.

Timeline: from 2 to 5 business days depending on complexity. Cost is calculated individually.

Guaranteed results and support

We have been integrating AWS and TTS for over 5 years, all engineers are certified. We provide full documentation and ready-made scripts so you can maintain the system yourself. We train your team on Polly and SSML, assist with debugging during testing. After project completion, you are left with a working solution and a clear understanding of its architecture.

Want to evaluate synthesis quality on your own data? Contact us — we will prepare a demo sample and calculate the optimal configuration for your scenario. Order a consultation to discuss details.