UpdateStateMachine - Amazon Step Functions
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

UpdateStateMachine

Updates an existing state machine by modifying its definition, roleArn, or loggingConfiguration. Running executions will continue to use the previous definition and roleArn. You must include at least one of definition or roleArn or you will receive a MissingRequiredParameter error.

If the given state machine Amazon Resource Name (ARN) is a qualified state machine ARN, it will fail with ValidationException.

A qualified state machine ARN refers to a Distributed Map state defined within a state machine. For example, the qualified state machine ARN arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel refers to a Distributed Map state with a label mapStateLabel in the state machine named stateMachineName.

Note

All StartExecution calls within a few seconds will use the updated definition and roleArn. Executions started immediately after calling UpdateStateMachine may use the previous state machine definition and roleArn.

Request Syntax

{ "definition": "string", "loggingConfiguration": { "destinations": [ { "cloudWatchLogsLogGroup": { "logGroupArn": "string" } } ], "includeExecutionData": boolean, "level": "string" }, "roleArn": "string", "stateMachineArn": "string", "tracingConfiguration": { "enabled": boolean } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

definition

The Amazon States Language definition of the state machine. See Amazon States Language.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1048576.

Required: No

loggingConfiguration

The LoggingConfiguration data type is used to set CloudWatch Logs options.

Type: LoggingConfiguration object

Required: No

roleArn

The Amazon Resource Name (ARN) of the IAM role of the state machine.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

Required: No

stateMachineArn

The Amazon Resource Name (ARN) of the state machine.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

Required: Yes

tracingConfiguration

Selects whether Amazon X-Ray tracing is enabled.

Type: TracingConfiguration object

Required: No

Response Syntax

{ "updateDate": number }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

updateDate

The date and time the state machine was updated.

Type: Timestamp

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidArn

The provided Amazon Resource Name (ARN) is not valid.

HTTP Status Code: 400

InvalidDefinition

The provided Amazon States Language definition is not valid.

HTTP Status Code: 400

InvalidLoggingConfiguration

HTTP Status Code: 400

InvalidTracingConfiguration

Your tracingConfiguration key does not match, or enabled has not been set to true or false.

HTTP Status Code: 400

MissingRequiredParameter

Request is missing a required parameter. This error occurs if both definition and roleArn are not specified.

HTTP Status Code: 400

StateMachineDeleting

The specified state machine is being deleted.

HTTP Status Code: 400

StateMachineDoesNotExist

The specified state machine does not exist.

HTTP Status Code: 400

ValidationException

The input does not satisfy the constraints specified by an Amazon service.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: