Create a state machine in Step Functions
You will create a state machine prototype for your credit card processing workflow using Step Functions’ Workflow Studio.
You’ll add all of the API actions and states from the Actions and Flow tabs using drag and drop in Workflow Studio. In the following topics, you'll define the conditions for the choice state, create your Lambda functions to process data, and configure all of the states in the workflow.
To create the state machine prototype
-
Open the Step Functions console
and choose Create state machine. -
In the Choose a template dialog box, select Blank.
-
Choose Select to open Workflow Studio in Design mode.
To add actions to your workflow
-
In Workflow Studio, from the Actions tab, drag an AWS Lambda Invoke API action and drop it to the empty state labelled Drag first state here. In the Configuration tab, for State name, enter
Get credit limit
. -
From the Flow tab, drag and drop a Choice state below the Get credit limit state. Rename the Choice state to
Determine if credit limit >= 5000?
. -
Drag and drop the following states as branches of the Choice state:
-
Amazon SNS Publish – From the Actions tab, drag and drop the Amazon SNS Publish API action. Rename this state to
Wait for human approval
. -
Pass state — From the Flow tab, drag and drop the Pass state. Rename this branch to
Auto-approve limit
. -
Drag and drop a Pass state below the Wait for human approval state. Rename this Pass state to
Credit limit approved
.
-
-
Add a Parallel state after the Choice state, configured as follows:
Drop the Parallel state after the Credit limit approved state.
-
Rename the Parallel state to
Verify applicant's identity and address
. -
Under both the branches of the Parallel state, drag and drop a Lambda Invoke API action.
-
Rename the Lambda states to:
Verify identity
andVerify address
Choose the Auto-approve limit state and for Next state, select Verify applicant's identity and address.
-
Drag a DynamoDB Scan state and drop it below the Verify applicant's identity and address state. Rename the DynamoDB Scan state to
Get list of credit bureaus
. -
Drag and drop a Map state after the Get list of credit bureaus state. Configure the Map state as follows:
Rename it to
Get scores from all credit bureaus
.For Processing mode, keep the default selection of Inline.
Drag and drop an AWS Lambda Invoke API action to the empty state labelled Drop state here.
Rename the AWS Lambda Invoke state to
Get all scores
.
Next steps
Now that you have a workflow prototype, you will learn how to set up and configure the resources. In the next section, Integrate a service, you will integrate a Lambda function into your workflow.