Melbourne Serverless Meetup - Feb 28 2017
Created by Shiva Narayanaswamy / @shivamaan
{
”Comment”: “Hello World Example",
"StartAt” : "HelloWorld”,
"States” : {
"HelloWorld” : {
"Type” : "Task",
"Resource” : "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME”,
"End” : true
}
}
}
Task | A single unit of work (Activity or Lambda) |
Choice | Branching logic |
Parallel | Fork and join data across tasks |
Wait | Delay |
Fail | Stops execution as a failure |
Suceed | Stops execution as a success |
Pass | Input to output pass through |
{
”Comment”: “Hello World Example",
"StartAt” : "HelloWorld”,
"States” : {
"HelloWorld” : {
"Type” : "Task",
"Resource” : "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME”,
"End” : true
}
}
}
"HelloWorld": {
"Type": "Task",
…
"Retry": [
{
"ErrorEquals": ["HandledError"],
"IntervalSeconds": 1,
"MaxAttempts": 2,
"BackoffRate": 2.0
},
… ]
"HelloWorld": {
"Type": "Task",
…
"Catch": [
{
"ErrorEquals": ["HandledError"],
"Next": "CustomErrorFallback"
},
{
"ErrorEquals": ["States.TaskFailed"],
"Next": "ReservedTypeFallback"
… ]
{
"X": {
"Type": "Task",
"Resource": "arn:aws:states:us-states-1:123456789012:task:X",
"Next": "Y",
"Retry": [
{
"ErrorEquals": [ "ErrorA", "ErrorB" ],
"IntervalSeconds": 1,
"BackoffRate": 2,
"MaxAttempts": 2
},
{
"ErrorEquals": [ "ErrorC" ],
"IntervalSeconds": 5
}
],
"Catch": [
{
"ErrorEquals": [ "States.ALL" ],
"Next": "Z"
}
]
}
"ChoiceState": {
"Type" : "Choice",
"Choices": [
{
"Variable": "$.foo",
"NumericEquals": 1,
"Next": "FirstMatchState"
},
{
"Variable": "$.foo",
"NumericEquals": 2,
… ]
"LookupCustomerInfo": {
"Type": "Parallel",
"Branches": [
{
"StartAt": "LookupAddress",
"States": {
"LookupAddress": {
"Type": "Task",
"Resource":
"arn:aws:lambda:us-east-1:123456789012:function:AddressFinder",
"End": true
}
}
},
{
"StartAt": "LookupPhone",
"States": {
"LookupPhone": {
"Type": "Task",
"Resource":
"arn:aws:lambda:us-east-1:123456789012:function:PhoneFinder",
"End": true
}
}
}
],
"Next": "NextState"
},
"wait_using_seconds": {
"Type": "Wait",
"Seconds": 10,
"Next": "wait_using_timestamp"
},
"wait_using_timestamp": {
"Type": "Wait",
"Timestamp": "2015-09-04T01:59:00Z",
"Next": "wait_using_timestamp_path"
},