Cost-optimization using Express Workflows
Step Functions determines pricing for Standard and Express workflows based on the workflow type you use to build your state machines. To optimize the cost of your serverless workflows, you can follow either or both of the following recommendations:
For information about how choosing a Standard or Express workflow type affects billing, see Amazon Step Functions Pricing
Tip #1: Nesting Express workflows inside Standard workflows
Step Functions runs workflows that have a finite duration and number of steps. Some workflows may complete execution within a short period of time. Others may require a combination of both long-running and high-event-rate workflows. With Step Functions, you can build large, complex workflows out of multiple smaller, simpler workflows.
For example, to build an order processing workflow, you can include all non-idempotent actions into a Standard workflow. This could include actions, such as approving order through human interaction and processing payments. You can then combine a series of idempotent actions, such as sending payment notifications and updating product inventory, in an Express workflow. You can nest this Express workflow within the Standard workflow. In this example, the Standard workflow is known as the parent state machine. The nested Express workflow is known as a child state machine.
Tip #2: Convert Standard workflows into Express workflows
You can convert your existing Standard workflows into Express workflows if they meet the following requirements:
-
The workflow must complete its execution within five minutes.
-
The workflow conforms to an at-least-once execution model. This means that each step in the workflow may run more than exactly once.
-
The workflow doesn't use the
.waitForTaskToken
or.sync
service integration patterns.
Important
Express workflows use Amazon CloudWatch Logs to record execution histories. You will incur additional costs when using CloudWatch Logs.
To convert a Standard workflow into an Express workflow using the console
-
Open the Step Functions console
. -
On the State machines page, choose a Standard type state machine to open it.
Tip
From the Any type dropdown list, choose Standard to filter the state machines list and view only Standard workflows.
-
Choose Copy to new.
Workflow Studio opens in Design mode displaying workflow of the state machine you selected.
-
(Optional) Update the workflow design.
-
Specify a name for your state machine. To do this, choose the edit icon next to the default state machine name of MyStateMachine. Then, in State machine configuration, specify a name in the State machine name box.
-
(Optional) In State machine configuration, specify other workflow settings, such as state machine type and its execution role.
Make sure that for Type, you choose Express. Keep all the other default selections on State machine settings.
Note
If you're converting a Standard workflow previously defined in Amazon CDK
or Amazon SAM, you must change the value of Type
andResource
name. -
In the Confirm role creation dialog box, choose Confirm to continue.
You can also choose View role settings to go back to State machine configuration.
Note
If you delete the IAM role that Step Functions creates, Step Functions can't recreate it later. Similarly, if you modify the role (for example, by removing Step Functions from the principals in the IAM policy), Step Functions can't restore its original settings later.
For more information about best practices and guidelines when you manage
cost-optimization for your workflows, see Building
cost-effective Amazon Step Functions workflows