# Polly long text: switch to the async task at 6000 characters

## TL;DR

Synthesizing long-form audio with Polly: anything over 6000 characters (3000 billed) fails SynthesizeSpeech with TextLengthExceededException, so switch to StartSpeechSynthesisTask for documents and chapters. Remember the task record expires after 72 hours, so fetch the output URI promptly. Good news: SSML markup doesn't count toward billed characters, so don't strip tags to save money.

Use this when you run into the situation in the title.

**When not to use this skill:** unrelated tasks. It covers only the procedure above.

## Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

## Details

Remember the task record expires after 72 hours, so fetch the output URI promptly. Good news: SSML markup doesn't count toward billed characters, so don't strip tags to save money.

Context: Official docs (Amazon Polly StartSpeechSynthesisTask API reference): documents the async path for long text. SynthesizeSpeech caps at 6000 total characters (3000 billed); SSML tags don't count as billed characters. StartSpeechSynthesisTask raises the cap to 200,000 total / 100,000 billed characters. The async call requires an S3 bucket for output (OutputS3BucketName, with optional OutputS3KeyPrefix) and optionally an SNS topic ARN for completion notifications. The returned task object is available for 72 hours; poll or subscribe to the SNS topic instead of guessing. InvalidS3BucketException / InvalidS3KeyException cover bucket and key problems.
