Step Functions

This document contains information about the Step Functions service supported in Handel. This Handel service provisions Step Functions state machine resources to provide an application workflow.

Service Limitations

No Activities

This service does not yet support Step Functions activity resources. Task resources are limited to Lambda functions.

Parameters

Parameter Type Required Default Description
type string Yes   This must always be stepfunctions for this service type.
definition State Machine Definition Yes   Path to file containing state machine definition.

State Machine Definition

For the most part, the definition file you provide in the definition section is in Amazon States Language. Instead of providing an ARN in the ‘Resource’ field of a state, however, one should give the service name from the Handel file.

Note

For convenience, Handel supports both JSON and YAML formats for the definition file, where pure States Language is based on JSON alone.

A definition file could look something like this:

StartAt: FooState
States:
  FooState:
    Type: Task
    Resource: foo # service name
    Next: BarState
  BarState:
    Type: Task
    Resource: bar # service name
    End: true

Example Handel File

version: 1

name: my-state-machine

environments:
  prd:
    foo:
      type: lambda
      path_to_code: foo/
      handler: lambda_function.lambda_handler
      runtime: python3.6
    bar:
      type: lambda
      path_to_code: bar/
      handler: lambda_function.lambda_handler
      runtime: python3.6
    machine:
      type: step_functions
      definition: state_machine.yml # definition file
      dependencies:
      - foo
      - bar

Depending on this service

The Lambda service outputs the following environment variables:

Environment Variable Description
<SERVICE_NAME>_STATE_MACHINE_NAME The name of the created Step Functions state machine
<SERVICE_NAME>_STATE_MACHINE_ARN The ARN of the created Step Functions state machine

See Environment Variable Names for information about how the service name is included in the environment variable name.

Events produced by this service

The Step Functions service does not produce events for other Handel services to consume.

Events consumed by this service

The Step Functions service does not consume events from other Handel services.