- Using the HelloWorld state machine build previously HelloWorld
- Go to Lambda Console
- Choose Functions
- Choose Create function
- Select Author from scratch
- In the Basic information pane, for Function name enter invokeStateMachine
- For Runtime, choose either Node.js 20.x
- Under Role, select Create a custom role
- Under Role Name, enter a name for this role. In this case, lambda_step_functions
- Choose Allow
- Leave architecture set to x86_64
- Choose Create function
- Go to IAM
- Choose Roles
- Enter the role previously created. In this case lambda_step_functions
- Open the role
- Choose Attach policies
- Look for step
- Enable AWSStepFunctionsFullAccess
- Choose Attach policy
- Go to Lambda Console
- Choose Functions
- Enter the previous function created. In this case, invokeStateMachine
- Under code panel, substitute the previous code with the code on the Project 7
- Choose Save
Ps: The state machine ARN is located on Step Functions console
- Choose Test
- Select Create new test event
- Under Event template, choose an option. In this case, Hello World
- Under Event name, enter a name. In this case, test
- Under code input space, you can set the input data for the function (JSON format)
{
"Comment": "Invoked from CloudWatch",
"number": 5
}- Choose Create
- Choose Test
- Under Execution result: ... (logs), you can see if the test was successful
- Go to Step Functions console
- Enter the previous created state machine. In this case, Helloworld
- Open Executions tab
- Enter the most recent execution
- Verify the details shown