> For the complete documentation index, see [llms.txt](https://ysfang82.gitbook.io/development-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ysfang82.gitbook.io/development-notes/aws-notes/service/service-communication/step-functions.md).

# Step Functions

**Introduction**

* Build a serverless visual workflow to orchestrate your Lambda functions / EC2 / ECS, on-premise servers, API Gateway.
* Represent flow as a JSON [state machine](https://en.wikipedia.org/wiki/Finite-state_machine).

**Feature**

* Tasks:
  * Lambda tasks
  * Activity tasks
    * Activity worker (HTTP), EC2 instances, mobile device, on-premise DC, they poll the Step Function servcie.
  * Service tasks
    * Connect to a supported AWS service
    * ECS task, Fargate, DynamoDB, Batch job, SNS topic, SQS.
  * Wait tasks
    * To wait for a duration or until a timestamp
* Can be triggered by:
  * API Gateway
  * CloudWatch events
  * SDK / CLI
* Includes: sequence, parallel, conditions, timeouts, error handling, human approval, etc.
* Maximum execution time: 1 year
* Be mindful to chain Lambda Functions about added latency.
