Introduction: Direct API Gateway to Step Functions

Welcome to the final lesson of this course on building serverless applications! So far, you have learned how to use AWS Lambda, API Gateway, and Step Functions to create and deploy serverless workflows. In this lesson, we will take your skills a step further by showing you how to use API Gateway to start Step Function executions directly — without needing a Lambda function in between.

This approach can make your applications faster and more cost-effective, since you avoid the extra step and cost of running Lambda just to start a workflow. You will learn how to use mapping templates to control the request and response, validate input, handle errors, and even route to different workflows — all using the Velocity Template Language (VTL).

By the end of this lesson, you will be able to build a robust API that starts Step Function executions with dynamic input and strong validation, all without writing any Lambda code.

Quick Recall: Mapping Templates and Direct Integrations

Before we dive in, let’s quickly remind ourselves what mapping templates are and why they matter.

A mapping template in API Gateway is a way to transform the incoming request or outgoing response. It lets you change the shape of the data, add or remove fields, and even add logic — using a language called Velocity Template Language (VTL).

In previous lessons, you may have seen mapping templates used to format data for Lambda functions. In this lesson, we will use them to talk directly to Step Functions, letting us control exactly how the API request is turned into a Step Function execution.

Generating Unique Execution Names with VTL
Input Validation in Request Mapping Templates
Transforming Step Functions Responses
Error Handling for Step Functions Integration
Dynamic Workflow Routing with Request Templates
Summary And Next Steps

In this lesson, you learned how to use API Gateway’s direct integration with Step Functions to build a flexible, robust API — without needing Lambda functions. You saw how to:

  • Generate unique execution names using VTL
  • Validate input and return helpful error messages
  • Transform Step Functions responses to be more user-friendly
  • Handle errors gracefully with custom status codes and messages
  • Route requests dynamically based on workflow type

You have now reached the end of this course on building serverless applications. Congratulations on making it this far! You are now ready to put these concepts into practice with the hands-on exercises that follow. Great work, and keep building!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal