AWS Step Functions - Hands On Demo
Create First Lambda Function
- Select "Author from scratch"
- Function name: FirstLambdaFunction
- Runtime: Python 3.12
- Keep other values as default.
- Paste the below code as function code.
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from First Lambda!')
}
Create Second Lambda Function
- Select "Author from scratch"
- Function name: SecondLambdaFunction
- Runtime: Python 3.12
- Keep other values as default.
- Paste the below code as function code.
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Second Lambda!')
}
Create a State Machine in AWS Step Functions
- Open Step Functions Console: Navigate to the Step Functions console in the AWS Management Console.
- Create State Machine: Click "Create state machine".
- Define State Machine: Choose "Code" and paste the following Amazon States Language (ASL) definition.
- Make sure to replace the ARN of the First and Second Lambda Function.
{
"Comment": "A state machine that calls two Lambda functions in sequence",
"StartAt": "FirstFunction",
"States": {
"FirstFunction": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:211125437318:function:FirstLambdaFunction",
"Next": "SecondFunction"
},
"SecondFunction": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:211125437318:function:SecondLambdaFunction",
"End": true
}
}
}
Start and Monitor Execution
- Start Execution: With the updated state machine, click "Start execution". Optionally, provide JSON input, though it's not required for this example.
- Monitor the Workflow: Watch as the state machine executes, first invoking FirstLambdaFunction and then SecondLambdaFunction. The execution detail page shows the progress and results of each step.
Available Templates - 1

Available Templates - 2

Thanks
for
Watching
Clean Up
- Delete the State Machine.
- Delete the Lambda Functions.
AWS Step Functions - Hands On Demo
By Deepak Dubey
AWS Step Functions - Hands On Demo
AWS Step Functions - Hands On Demo
- 263