This sample demonstrates AWS Step Functions orchestrating multiple Lambda functions in a parallel workflow pattern.
Input: {"adam": "LocalStack", "cole": "Stack"}
|
v
+---------------+
| Parallel State|
+-------+-------+
|
+----------+----------+
| |
v v
+-------------+ +-------------+
| Adam Lambda | | Cole Lambda |
| (extracts | | (extracts |
| "adam") | | "cole") |
+------+------+ +------+------+
| |
+----------+----------+
|
v
+-----------------+
| Combine Lambda |
| (joins results) |
+--------+--------+
|
v
Output: "Together Adam and Cole say 'LocalStack Stack'!!"
- AWS Step Functions: Workflow orchestration
- AWS Lambda: Serverless compute (3 functions)
- AWS IAM: Execution roles
- Parallel State: Running multiple branches concurrently
- Lambda Integration: Using Step Functions to invoke Lambda functions
- Data Flow: Passing data between states
- State Machine Definition: Amazon States Language (ASL)
- LocalStack Pro running
- AWS CLI or awslocal installed
- jq for JSON parsing
# Deploy the sample
./scripts/deploy.sh
# Run tests
./scripts/test.shThe test script validates:
| Test | Description |
|---|---|
| Lambda State | All 3 functions are Active |
| State Machine | State machine is ACTIVE |
| Adam Lambda | Returns extracted 'adam' value |
| Cole Lambda | Returns extracted 'cole' value |
| Combine Lambda | Returns combined message |
| Execution | State machine completes with SUCCEEDED |
| Output | Final output matches expected format |
Input:
{"adam": "LocalStack", "cole": "Stack"}Workflow:
- Parallel State receives input
- Adam Lambda extracts and returns:
"LocalStack" - Cole Lambda extracts and returns:
"Stack" - Combine Lambda receives
["LocalStack", "Stack"] - Returns:
"Together Adam and Cole say 'LocalStack Stack'!!"
# Start an execution
awslocal stepfunctions start-execution \
--state-machine-arn "$STATE_MACHINE_ARN" \
--input '{"adam": "Hello", "cole": "World"}'
# Check execution status
awslocal stepfunctions describe-execution \
--execution-arn "$EXECUTION_ARN"Resources are automatically cleaned up when LocalStack restarts.