Orchestrating Amazon SAM resources with Amazon Step Functions - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Orchestrating Amazon SAM resources with Amazon Step Functions

You can use Amazon Step Functions to orchestrate Amazon Lambda functions and other Amazon resources to form complex and robust workflows. Step Functions to tell your application when and under what conditions your Amazon resources, like Amazon Lambda functions, are used. This simplifies the process of forming complex and robust workflows. Using AWS::Serverless::StateMachine, you define the individual steps in your workflow, associate resources in each step, and then sequence these steps together. You also add transitions and conditions where they are needed. This simplifies the process of making a complex and robust workflow.

Note

To manage Amazon SAM templates that contain Step Functions state machines, you must use version 0.52.0 or later of the Amazon SAM CLI. To check which version you have, execute the command sam --version.

Step Functions is based on the concepts of tasks and state machines. You define state machines using the JSON-based Amazon States Language. The Step Functions console displays a graphical view of your state machine's structure so you can visually check your state machine's logic and monitor executions.

With Step Functions support in Amazon Serverless Application Model (Amazon SAM), you can do the following:

  • Define state machines, either directly within an Amazon SAM template or in a separate file

  • Create state machine execution roles through Amazon SAM policy templates, inline policies, or managed policies

  • Trigger state machine executions with API Gateway or Amazon EventBridge events, on a schedule within an Amazon SAM template, or by calling APIs directly

  • Use available Amazon SAM Policy Templates for common Step Functions development patterns.

Example

The following example snippet from a Amazon SAM template file defines a Step Functions state machine in a definition file. Note that the my_state_machine.asl.json file must be written in Amazon States Language.

AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: Sample SAM template with Step Functions State Machine Resources: MyStateMachine: Type: AWS::Serverless::StateMachine Properties: DefinitionUri: statemachine/my_state_machine.asl.json ...

To download a sample Amazon SAM application that includes a Step Functions state machine, see Create a Step Functions State Machine Using Amazon SAM in the Amazon Step Functions Developer Guide.

More information

To learn more about Step Functions and using it with Amazon SAM, see the following: