Amazon Polly
Developer Guide


The following Python code example uses the AWS SDK for Python (Boto) to list the lexicons in your account in the region specified in your local AWS configuration. For information about creating the configuration file, see Step 3.1: Set Up the AWS Command Line Interface (AWS CLI).

For more information on the API, see the reference for SynthesizeSpeech API.

import boto3 polly_client = boto3.Session( aws_access_key_id=, aws_secret_access_key=, region_name='us-west-2').client('polly') response = polly_client.synthesize_speech(VoiceId='Joanna', OutputFormat='mp3', Text = 'This is a sample text to be synthesized.') file = open('speech.mp3', 'wb') file.write(response['AudioStream'].read()) file.close()