- Navigation GuideYou are on a Client landing page. Commands (operations) are listed on this page. The Client constructor type is linked at the bottom.
SFNClient
Step Functions coordinates the components of distributed applications and microservices using visual workflows.
You can use Step Functions to build applications from individual components, each of which performs a discrete function, or task, allowing you to scale and change applications quickly. Step Functions provides a console that helps visualize the components of your application as a series of steps. Step Functions automatically triggers and tracks each step, and retries steps when there are errors, so your application executes predictably and in the right order every time. Step Functions logs the state of each step, so you can quickly diagnose and debug any issues.
Step Functions manages operations and underlying infrastructure to ensure your application is available at any scale. You can run tasks on Amazon Web Services, your own servers, or any system that has access to Amazon Web Services. You can access and use Step Functions using the console, the Amazon Web Services SDKs, or an HTTP API. For more information about Step Functions, see the Step Functions Developer Guide .
If you use the Step Functions API actions using Amazon Web Services SDK integrations, make sure the API actions are in camel case and parameter names are in Pascal case. For example, you could use Step Functions API action startSyncExecution
and specify its parameter as StateMachineArn
.
Installation
npm install @aws-sdk/client-sfn
yarn add @aws-sdk/client-sfn
pnpm add @aws-sdk/client-sfn
SFNClient Operations
Command | Summary |
---|
Command | Summary |
---|---|
CreateActivityCommand | Creates an activity. An activity is a task that you write in any programming language and host on any machine that has access to Step Functions. Activities must poll Step Functions using the This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
CreateStateMachineAliasCommand | Creates an alias for a state machine that points to one or two versions of the same state machine. You can set your application to call StartExecution with an alias and update the version the alias uses without changing the client's code. You can also map an alias to split StartExecution requests between two versions of a state machine. To do this, add a second To create an alias that points to a single version, specify a single You can create up to 100 aliases for each state machine. You must delete unused aliases using the DeleteStateMachineAlias API action. Related operations:
|
CreateStateMachineCommand | Creates a state machine. A state machine consists of a collection of states that can do work ( If you set the For additional control over security, you can encrypt your data using a customer-managed key for Step Functions state machines. You can configure a symmetric KMS key and data key reuse period when creating or updating a State Machine. The execution history and state machine definition will be encrypted with the key applied to the State Machine. This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
DeleteActivityCommand | Deletes an activity. |
DeleteStateMachineAliasCommand | Deletes a state machine alias . After you delete a state machine alias, you can't use it to start executions. When you delete a state machine alias, Step Functions doesn't delete the state machine versions that alias references. Related operations:
|
DeleteStateMachineCommand | Deletes a state machine. This is an asynchronous operation. It sets the state machine's status to A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN. The following are some examples of qualified and unqualified state machine ARNs:
For |
DeleteStateMachineVersionCommand | Deletes a state machine version . After you delete a version, you can't call StartExecution using that version's ARN or use the version with a state machine alias . Deleting a state machine version won't terminate its in-progress executions. You can't delete a state machine version currently referenced by one or more aliases. Before you delete a version, you must either delete the aliases or update them to point to another state machine version. Related operations:
|
DescribeActivityCommand | Describes an activity. This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
DescribeExecutionCommand | Provides information about a state machine execution, such as the state machine associated with the execution, the execution input and output, and relevant execution metadata. If you've redriven an execution, you can use this API action to return information about the redrives of that execution. In addition, you can use this API action to return the Map Run Amazon Resource Name (ARN) if the execution was dispatched by a Map Run. If you specify a version or alias ARN when you call the StartExecution API action, This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. Executions of an |
DescribeMapRunCommand | Provides information about a Map Run's configuration, progress, and results. If you've redriven a Map Run, this API action also returns information about the redrives of that Map Run. For more information, see Examining Map Run in the Step Functions Developer Guide. |
DescribeStateMachineAliasCommand | Returns details about a state machine alias . Related operations:
|
DescribeStateMachineCommand | Provides information about a state machine's definition, its IAM role Amazon Resource Name (ARN), and configuration. A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN. The following are some examples of qualified and unqualified state machine ARNs:
This API action returns the details for a state machine version if the This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
DescribeStateMachineForExecutionCommand | Provides information about a state machine's definition, its execution role ARN, and configuration. If a Map Run dispatched the execution, this action returns the Map Run Amazon Resource Name (ARN) in the response. The state machine returned is the state machine associated with the Map Run. This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. This API action is not supported by |
GetActivityTaskCommand | Used by workers to retrieve a task (with the specified activity ARN) which has been scheduled for execution by a running state machine. This initiates a long poll, where the service holds the HTTP connection open and responds as soon as a task becomes available (i.e. an execution of a task of this type is needed.) The maximum time the service holds on to the request before responding is 60 seconds. If no task is available within 60 seconds, the poll returns a This API action isn't logged in CloudTrail. Workers should set their client side socket timeout to at least 65 seconds (5 seconds higher than the maximum time the service may hold the poll request). Polling with |
GetExecutionHistoryCommand | Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the If This API action is not supported by |
ListActivitiesCommand | Lists the existing activities. If This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
ListExecutionsCommand | Lists all executions of a state machine or a Map Run. You can list all executions related to a state machine by specifying a state machine Amazon Resource Name (ARN), or those related to a Map Run by specifying a Map Run ARN. Using this API action, you can also list all redriven executions. You can also provide a state machine alias ARN or version ARN to list the executions associated with a specific alias or version. Results are sorted by time, with the most recent execution first. If This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. This API action is not supported by |
ListMapRunsCommand | Lists all Map Runs that were started by a given state machine execution. Use this API action to obtain Map Run ARNs, and then call |
ListStateMachineAliasesCommand | Lists aliases for a specified state machine ARN. Results are sorted by time, with the most recently created aliases listed first. To list aliases that reference a state machine version , you can specify the version ARN in the If Related operations:
|
ListStateMachineVersionsCommand | Lists versions for the specified state machine Amazon Resource Name (ARN). The results are sorted in descending order of the version creation time. If Related operations:
|
ListStateMachinesCommand | Lists the existing state machines. If This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. |
ListTagsForResourceCommand | List tags for a given resource. Tags may only contain Unicode letters, digits, white space, or these symbols: |
PublishStateMachineVersionCommand | Creates a version from the current revision of a state machine. Use versions to create immutable snapshots of your state machine. You can start executions from versions either directly or with an alias. To create an alias, use CreateStateMachineAlias. You can publish up to 1000 versions for each state machine. You must manually delete unused versions using the DeleteStateMachineVersion API action. Related operations:
|
RedriveExecutionCommand | Restarts unsuccessful executions of Standard workflows that didn't complete successfully in the last 14 days. These include failed, aborted, or timed out executions. When you redrive an execution, it continues the failed execution from the unsuccessful step and uses the same input. Step Functions preserves the results and execution history of the successful steps, and doesn't rerun these steps when you redrive an execution. Redriven executions use the same state machine definition and execution ARN as the original execution attempt. For workflows that include an Inline Map or Parallel state, To redrive a workflow that includes a Distributed Map state whose Map Run failed, you must redrive the parent workflow . The parent workflow redrives all the unsuccessful states, including a failed Map Run. If a Map Run was not started in the original execution attempt, the redriven parent workflow starts the Map Run. This API action is not supported by However, you can restart the unsuccessful executions of Express child workflows in a Distributed Map by redriving its Map Run. When you redrive a Map Run, the Express child workflows are rerun using the StartExecution API action. For more information, see Redriving Map Runs . You can redrive executions if your original execution meets the following conditions:
|
SendTaskFailureCommand | Used by activity workers, Task states using the callback pattern, and optionally Task states using the job run pattern to report that the task identified by the For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role. A caller can mark a task as fail without using any KMS permissions in the execution role if the caller provides a null value for both |
SendTaskHeartbeatCommand | Used by activity workers and Task states using the callback pattern, and optionally Task states using the job run pattern to report to Step Functions that the task represented by the specified The |
SendTaskSuccessCommand | |
StartExecutionCommand | Starts a state machine execution. A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN. The following are some examples of qualified and unqualified state machine ARNs:
If you start an execution with an unqualified state machine ARN, Step Functions uses the latest revision of the state machine for the execution. To start executions of a state machine version , call |
StartSyncExecutionCommand | Starts a Synchronous Express state machine execution. This API action isn't logged in CloudTrail. |
StopExecutionCommand | Stops an execution. This API action is not supported by For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role. A caller can stop an execution without using any KMS permissions in the execution role if the caller provides a null value for both |
TagResourceCommand | Add a tag to a Step Functions resource. An array of key-value pairs. For more information, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide, and Controlling Access Using IAM Tags . Tags may only contain Unicode letters, digits, white space, or these symbols: |
TestStateCommand | Accepts the definition of a single state and executes it. You can test a state without creating a state machine or updating an existing state machine. Using this API, you can test the following:
You can call this API on only one state at a time. The states that you can test include the following: The The |
UntagResourceCommand | Remove a tag from a Step Functions resource |
UpdateMapRunCommand | Updates an in-progress Map Run's configuration to include changes to the settings that control maximum concurrency and Map Run failure. |
UpdateStateMachineAliasCommand | Updates the configuration of an existing state machine alias by modifying its You must specify at least one of the This operation is eventually consistent. All StartExecution requests made within a few seconds use the latest alias configuration. Executions started immediately after calling Related operations:
|
UpdateStateMachineCommand | Updates an existing state machine by modifying its A qualified state machine ARN refers to a Distributed Map state defined within a state machine. For example, the qualified state machine ARN A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN. The following are some examples of qualified and unqualified state machine ARNs:
After you update your state machine, you can set the Step Functions assigns monotonically increasing integers for state machine versions, starting at version number 1. All |
ValidateStateMachineDefinitionCommand | Validates the syntax of a state machine definition specified in Amazon States Language (ASL), a JSON-based, structured language. You can validate that a state machine definition is correct without creating a state machine resource. Suggested uses for
Validation will look for problems in your state machine definition and return a result and a list of diagnostic elements. The result value will be The list of ValidateStateMachineDefinitionDiagnostic data elements can contain zero or more WARNING and/or ERROR elements. The ValidateStateMachineDefinition API might add new diagnostics in the future, adjust diagnostic codes, or change the message wording. Your automated processes should only rely on the value of the result field value (OK, FAIL). Do not rely on the exact order, count, or wording of diagnostic messages. |
SFNClient Configuration
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
defaultsMode Optional | DefaultsMode | Provider<DefaultsMode> | The @smithy/smithy-client#DefaultsMode that will be used to determine how certain default configuration options are resolved in the SDK. |
disableHostPrefix Optional | boolean | Disable dynamically changing the endpoint of the client based on the hostPrefix trait of an operation. |
extensions Optional | RuntimeExtension[] | Optional extensions |
logger Optional | Logger | Optional logger for logging debug/info/warn/error. |
maxAttempts Optional | number | Provider<number> | Value for how many times a request will be made at most in case of retry. |
profile Optional | string | Setting a client profile is similar to setting a value for the AWS_PROFILE environment variable. Setting a profile on a client in code only affects the single client instance, unlike AWS_PROFILE.When set, and only for environments where an AWS configuration file exists, fields configurable by this file will be retrieved from the specified profile within that file. Conflicting code configuration and environment variables will still have higher priority.For client credential resolution that involves checking the AWS configuration file, the client's profile (this value) will be used unless a different profile is set in the credential provider options. |
region Optional | string | Provider<string> | The AWS region to which this client will send requests |
requestHandler Optional | __HttpHandlerUserInput | The HTTP handler to use or its constructor options. Fetch in browser and Https in Nodejs. |
retryMode Optional | string | Provider<string> | Specifies which retry algorithm to use. |
useDualstackEndpoint Optional | boolean | Provider<boolean> | Enables IPv6/IPv4 dualstack endpoint. |
useFipsEndpoint Optional | boolean | Provider<boolean> | Enables FIPS compatible endpoints. |
Additional config fields are described in the full configuration type: SFNClientConfig