Coordinating AI Services with Step Functions

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

The individual machine learning services provided by AWS are incredibly powerful by themselves, but when used together, they are extraordinary. Chaining the services together can create truly magical experiences. However, the outputs and inputs of each of these services need to be coordinated because each service takes a varying amount of time based on the original input data. Step Functions are one way to keep track of all of these moving pieces.

In this lab, you will be modifying an existing pipeline to learn how to set up the coordination between the services. We will be using Lambda functions in the background to run the logic of our pipeline, but all of the Lambda functions are provided for you.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Add Translation to the Pipeline
  1. Inspect the existing Step Functions pipeline.
  2. Once the audio transcription is available, translate the text to Spanish.
    • Hint: Check out the provided Lambda functions.
  3. The translation must be complete before the audio can be made from it. Make sure this step is complete before continuing the pipeline.
Add Sentiment Analysis to the Pipeline
  1. Once the audio transcription is available, determine whether the audio content feels positive or negative.
  2. This sentiment will determine the output folder of our translated audio file, so make sure it is done before continuing the pipeline.
    • Hint: The sentiment processing uses the original transcription text. It does not need the translated text.
Convert the Translated Text to Audio
  1. Using the sentiment and translated text, convert the text to speech.
  2. Store the result in the output S3 bucket in a folder named for the sentiment it represents.
Upload Audio and Watch the Magic
  1. Upload 1 of the audio files provided in the GitHub respository.
  2. Watch the Step Function pipeline as it is processing.
  3. Once complete, view the output S3 bucket. Did the audio get categorized correctly?
  4. Download the translated audio file, and have a listen!

Additional Resources


Our company creates short audio clips of interesting information for sharing on social media. While we try to keep our content positive, some of what we provide is news about something bad happening. Recently, we have been receiving requests to provide our content in Spanish as well to serve a broader audience. While we are in the process of hiring Spanish speakers, we can take advantage of machine learning to translate our back catalog of content.

We are already using Transcribe to convert our audio files to text and managing the pipeline with Step Functions. Our goal is to update the pipeline to convert the audio transcripts into Spanish and then have the translated text converted back to audio to be ready to share. Additionally, our development team has asked us to determine if each audio clip contains something negative, so that a warning can be placed on the content.


The development team has provided all of the business logic code you will need as Lambda functions. An input S3 bucket is set up to automatically process mp3 audio files uploaded to the bucket using the existing Step Functions pipeline. An output bucket is provided to hold the finished audio files.

Example audio files are provided for you on GitHub.

Lab Goals

  1. Add Translation to the Pipeline
  2. Add Sentiment Analysis to the Pipeline
  3. Convert the Translated Text to Audio
  4. Upload Audio and Watch the Magic

Logging in to the Lab Environment

To avoid issues with the lab, use a new Incognito or Private browser window to log in to the lab. This ensures that your personal account credentials, which may be active in your main window, are not used for the lab.

Log in to the AWS console using the account credentials provided with the lab. Please make sure you are in the us-east-1 (N. Virginia) region when in the AWS console.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?