AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates a state machine. A state machine consists of a collection of states that can do work (Task states), determine to which states to transition next (Choice states), stop an execution with an error (Fail states), and so on. State machines are specified using a JSON-based, structured language. For more information, see Amazon States Language in the Step Functions User Guide.

If you set the publish parameter of this API action to true, it publishes version 1 as the first revision of the state machine.

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.

CreateStateMachine is an idempotent API. Subsequent requests won’t create a duplicate resource if it was already created. CreateStateMachine's idempotency check is based on the state machine name, definition, type, LoggingConfiguration, TracingConfiguration, and EncryptionConfiguration The check is also based on the publish and versionDescription parameters. If a following request has a different roleArn or tags, Step Functions will ignore these differences and treat it as an idempotent request of the previous. In this case, roleArn and tags will not be updated, even if they are different.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginCreateStateMachine and EndCreateStateMachine.

Namespace: Amazon.StepFunctions
Assembly: AWSSDK.StepFunctions.dll
Version: 3.x.y.z

Syntax

C#
public abstract Task<CreateStateMachineResponse> CreateStateMachineAsync(
         CreateStateMachineRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.StepFunctions.Model.CreateStateMachineRequest

Container for the necessary parameters to execute the CreateStateMachine service method.

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


The response from the CreateStateMachine service method, as returned by StepFunctions.

Exceptions

ExceptionCondition
ConflictException Updating or deleting a resource can cause an inconsistent state. This error occurs when there're concurrent requests for DeleteStateMachineVersion, PublishStateMachineVersion, or UpdateStateMachine with the publish parameter set to true. HTTP Status Code: 409
InvalidArnException The provided Amazon Resource Name (ARN) is not valid.
InvalidDefinitionException The provided Amazon States Language definition is not valid.
InvalidEncryptionConfigurationException Received when encryptionConfiguration is specified but various conditions exist which make the configuration invalid. For example, if type is set to CUSTOMER_MANAGED_KMS_KEY, but kmsKeyId is null, or kmsDataKeyReusePeriodSeconds is not between 60 and 900, or the KMS key is not symmetric or inactive.
InvalidLoggingConfigurationException Configuration is not valid.
InvalidNameException The provided name is not valid.
InvalidTracingConfigurationException Your tracingConfiguration key does not match, or enabled has not been set to true or false.
KmsAccessDeniedException Either your KMS key policy or API caller does not have the required permissions.
KmsThrottlingException Received when KMS returns ThrottlingException for a KMS call that Step Functions makes on behalf of the caller.
StateMachineAlreadyExistsException A state machine with the same name but a different definition or role ARN already exists.
StateMachineDeletingException The specified state machine is being deleted.
StateMachineLimitExceededException The maximum number of state machines has been reached. Existing state machines must be deleted before a new state machine can be created.
StateMachineTypeNotSupportedException State machine type is not supported.
TooManyTagsException You've exceeded the number of tags allowed for a resource. See the Limits Topic in the Step Functions Developer Guide.
ValidationException The input does not satisfy the constraints specified by an Amazon Web Services service.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer

See Also