Skip to content

AWS Step

milowedo edited this page Jun 16, 2020 · 5 revisions

AWS Step Functions [draft]

TO DO..

Capabilities

  • Invoking Lambdas, s3 etc
  • All lambdas can be defined in a consecutive sequence
  • Choice options, automatic retries, out of box waits
  • Automatic scaling
  • Parallel execution
  • Time is measured for each step

Defining workflows

Amazon Step Functions is a state machine that has a definition of all possible steps and the transitions between them.

State machines are defined using JSON based language called Amazon States Language.

Example of a simple state machine definition

{
  "Comment": "Description of the state machine (all comments are optional)",
  "StartAt": "first_state",
  "States": {
    "first_state": {
      "Resource": "<ARN to Lambda function which should be executed in this step>",
      "Type": "Task",
      "Next": "parallel_state"
    },
    "parallel_state": {
      "Type": "Parallel",
      "Next": "final_step",
      "Branches": [
        
        {
          "StartAt": "some_long_step",
          "States": {
            "some_long_step": {
              "Type": "Task",
              "Resource": "<ARN to Lambda function which should be executed in this step>",
              "End": true
            }
          }
        },
        
        {
          "StartAt": "pass",
          "States": {
            "pass": {
              "Type": "Pass",
              "Next": "some_other_step"
            },
            "some_other_step": {
              "Type": "Task",
              "Resource": "<ARN to Lambda function which should be executed in this step>",
              "Next": "wait_10s"
            },
            "wait_10s": {
              "Type": "Wait",
              "Seconds": 10,
              "End": true
            }
          }
        }
      ]
    },
    "final_step": {
      "Type": "Pass",
      "End": true
    }
  }
}

The state machine starts in state defined in the StartAt field. Then the system looks for a Next field and continues with the next defined state. This happens until an error occurs or the system encounters the End state.

For more information about syntax of this language, see the Amazon States Language Documentation

Limitations

  • 1MB maximum request payload size - bigger inputs need to be stores in S3
  • throttling aws api requests if they come in spikes that floods workflow and hits api limits
  • changeable in aws support center, but still:
    • number of state machines/account
    • number of concurrent executions

Pricing

  • Free tier has 4000 aws step functions/month - always, all accounts
  • After that 4k we have 0.025$ per 1000 state transitions
Clone this wiki locally