Using AWS Step Functions in CFML: Introducing the Second Example Step Functions Workflow

Posted 24 May 2019

Now that we’re done looking at the basics of Step Functions via the first example Step Functions workflow, it’s time to move on to something more powerful — and complicated. The second example Step Functions workflow that I will cover in the rest of this series combines a number of AI-based services from AWS into a powerful workflow that can transcribe, translate, and speak the translation of the spoken content of a video. The code for the complete workflow can be found in the AWSPlaybox app in stateMachines/transcribeTranslateSpeakWorkflow.json.

An Overview of the Workflow

This workflow uses a number of AWS services to help us meet our moral and legal obligations around creating accessible media for our websites. The law in many parts of the world — and not just for governmental organziations — is that we must provide accessible alternatives for the media we post to our websites. In the case of videos, we must provide captions or transcripts.

This workflow also helps us meet the needs of our growing international audiences. Not everyone is a native English speaker, and English speakers who speak quickly (like me) can be difficult to understand for non-native English speakers. By providing alternative forms of rich media content in a customer’s native language, we can better reach our customers and make them feel more welcome on our website.

The workflow uses AWS Transcribe, AWS Translate, and AWS Polly to achieve these goals. I covered both Transcribe and Translate in two earlier series of posts on this blog. Just like Transcribe, Polly is a part of the Alexa infrastructure. Polly synthesizes human speech from text input. Every time Alexa answers a question for you, you’re hearing Polly at work.

The visual description of the workflow generated by the Step Functions console looks like this:

Diagram showing execution flow of the transcribe, translate, and speak worfklow.

You’ll notice that it is dominated by two primary constructs: a loop at the top, and a set of parallel branches at the bottom. As I cover the workflow in detail, I’ll show how to build both of these constructs in your own Step Functions workflow JSON. I’ll also cover a couple of new state types — Wait and Parallel — and introduce you to the power of error handling and retries in Step Functions workflows.

Categories: AWS ColdFusion