SFN / Client / update_state_machine

update_state_machine#

SFN.Client.update_state_machine(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.update_state_machine(
    stateMachineArn='string',
    definition='string',
    roleArn='string',
    loggingConfiguration={
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    tracingConfiguration={
        'enabled': True|False
    }
)
Parameters:
  • stateMachineArn (string) –

    [REQUIRED]

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

  • definition (string) – The Amazon States Language definition of the state machine. See Amazon States Language.

  • roleArn (string) – The Amazon Resource Name (ARN) of the IAM role of the state machine.

  • loggingConfiguration (dict) –

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

    • level (string) –

      Defines which category of execution history events are logged.

    • includeExecutionData (boolean) –

      Determines whether execution data is included in your log. When set to false, data is excluded.

    • destinations (list) –

      An array of objects that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF.

      • (dict) –

        • cloudWatchLogsLogGroup (dict) –

          An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the CloudFormation User Guide.

          • logGroupArn (string) –

            The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

  • tracingConfiguration (dict) –

    Selects whether X-Ray tracing is enabled.

    • enabled (boolean) –

      When set to true, X-Ray tracing is enabled.

Return type:

dict

Returns:

Response Syntax

{
    'updateDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • updateDate (datetime) –

      The date and time the state machine was updated.

Exceptions

  • SFN.Client.exceptions.InvalidArn

  • SFN.Client.exceptions.InvalidDefinition

  • SFN.Client.exceptions.InvalidLoggingConfiguration

  • SFN.Client.exceptions.InvalidTracingConfiguration

  • SFN.Client.exceptions.MissingRequiredParameter

  • SFN.Client.exceptions.StateMachineDeleting

  • SFN.Client.exceptions.StateMachineDoesNotExist

  • SFN.Client.exceptions.ValidationException