There are more AWS SDK examples available in the AWS Doc SDK Examples
Convert text to speech and back to text using an AWS SDK
The following code example shows how to:
Use Amazon Polly to synthesize a plain text (UTF-8) input file to an audio file.
Upload the audio file to an Amazon S3 bucket.
Use Amazon Transcribe to convert the audio file to text.
Display the text.