AWS Step Functions

2020/09/14 - AWS Step Functions - 6 updated api methods

Changes  This release of the AWS Step Functions SDK introduces support for AWS X-Ray.

CreateStateMachine (updated) Link ¶
Changes (request)
{'tracingConfiguration': {'enabled': 'boolean'}}

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 AWS Step Functions User Guide.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

Note

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 and TracingConfiguration . 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.

See also: AWS API Documentation

Request Syntax

client.create_state_machine(
    name='string',
    definition='string',
    roleArn='string',
    type='STANDARD'|'EXPRESS',
    loggingConfiguration={
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    tracingConfiguration={
        'enabled': True|False
    }
)
type name

string

param name

[REQUIRED]

The name of the state machine.

A name must not contain:

  • white space

  • brackets < > { } [ ]

  • wildcard characters ? *

  • special characters " # % \ ^ | ~ ` $ & , ; : /

  • control characters ( U+0000-001F , U+007F-009F )

To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

type definition

string

param definition

[REQUIRED]

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

type roleArn

string

param roleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the IAM role to use for this state machine.

type type

string

param type

Determines whether a Standard or Express state machine is created. The default is STANDARD . You cannot update the type of a state machine once it has been created.

type loggingConfiguration

dict

param loggingConfiguration

Defines what execution history events are logged and where they are logged.

Note

By default, the level is set to OFF . For more information see Log Levels in the AWS Step Functions User Guide.

  • 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 AWS 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 :*

type tags

list

param tags

Tags to be added when creating a state machine.

An array of key-value pairs. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide , and Controlling Access Using IAM Tags.

Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @ .

  • (dict) --

    Tags are key-value pairs that can be associated with Step Functions state machines and activities.

    An array of key-value pairs. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide , and Controlling Access Using IAM Tags.

    Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @ .

    • key (string) --

      The key of a tag.

    • value (string) --

      The value of a tag.

type tracingConfiguration

dict

param tracingConfiguration

Selects whether AWS X-Ray tracing is enabled.

  • enabled (boolean) --

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

rtype

dict

returns

Response Syntax

{
    'stateMachineArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the created state machine.

    • creationDate (datetime) --

      The date the state machine is created.

DescribeExecution (updated) Link ¶
Changes (response)
{'traceHeader': 'string'}

Describes an execution.

Note

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 EXPRESS state machines.

See also: AWS API Documentation

Request Syntax

client.describe_execution(
    executionArn='string'
)
type executionArn

string

param executionArn

[REQUIRED]

The Amazon Resource Name (ARN) of the execution to describe.

rtype

dict

returns

Response Syntax

{
    'executionArn': 'string',
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
    'startDate': datetime(2015, 1, 1),
    'stopDate': datetime(2015, 1, 1),
    'input': 'string',
    'inputDetails': {
        'included': True|False
    },
    'output': 'string',
    'outputDetails': {
        'included': True|False
    },
    'traceHeader': 'string'
}

Response Structure

  • (dict) --

    • executionArn (string) --

      The Amazon Resource Name (ARN) that id entifies the execution.

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) of the executed stated machine.

    • name (string) --

      The name of the execution.

      A name must not contain:

      • white space

      • brackets < > { } [ ]

      • wildcard characters ? *

      • special characters " # % \ ^ | ~ ` $ & , ; : /

      • control characters ( U+0000-001F , U+007F-009F )

      To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

    • status (string) --

      The current status of the execution.

    • startDate (datetime) --

      The date the execution is started.

    • stopDate (datetime) --

      If the execution has already ended, the date the execution stopped.

    • input (string) --

      The string that contains the JSON input data of the execution. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

    • inputDetails (dict) --

      Provides details about execution input or output.

      • included (boolean) --

        Indicates whether input or output was included in the response. Always true for API calls.

    • output (string) --

      The JSON output data of the execution. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

      Note

      This field is set only if the execution succeeds. If the execution fails, this field is null.

    • outputDetails (dict) --

      Provides details about execution input or output.

      • included (boolean) --

        Indicates whether input or output was included in the response. Always true for API calls.

    • traceHeader (string) --

      The AWS X-Ray trace header which was passed to the execution.

DescribeStateMachine (updated) Link ¶
Changes (response)
{'tracingConfiguration': {'enabled': 'boolean'}}

Describes a state machine.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

See also: AWS API Documentation

Request Syntax

client.describe_state_machine(
    stateMachineArn='string'
)
type stateMachineArn

string

param stateMachineArn

[REQUIRED]

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

rtype

dict

returns

Response Syntax

{
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'ACTIVE'|'DELETING',
    'definition': 'string',
    'roleArn': 'string',
    'type': 'STANDARD'|'EXPRESS',
    'creationDate': datetime(2015, 1, 1),
    'loggingConfiguration': {
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    'tracingConfiguration': {
        'enabled': True|False
    }
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the state machine.

    • name (string) --

      The name of the state machine.

      A name must not contain:

      • white space

      • brackets < > { } [ ]

      • wildcard characters ? *

      • special characters " # % \ ^ | ~ ` $ & , ; : /

      • control characters ( U+0000-001F , U+007F-009F )

      To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

    • status (string) --

      The current status 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 used when creating this state machine. (The IAM role maintains security by granting Step Functions access to AWS resources.)

    • type (string) --

      The type of the state machine ( STANDARD or EXPRESS ).

    • creationDate (datetime) --

      The date the state machine is created.

    • 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 AWS 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 AWS X-Ray tracing is enabled.

      • enabled (boolean) --

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

DescribeStateMachineForExecution (updated) Link ¶
Changes (response)
{'tracingConfiguration': {'enabled': 'boolean'}}

Describes the state machine associated with a specific execution.

Note

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 EXPRESS state machines.

See also: AWS API Documentation

Request Syntax

client.describe_state_machine_for_execution(
    executionArn='string'
)
type executionArn

string

param executionArn

[REQUIRED]

The Amazon Resource Name (ARN) of the execution you want state machine information for.

rtype

dict

returns

Response Syntax

{
    'stateMachineArn': 'string',
    'name': 'string',
    'definition': 'string',
    'roleArn': 'string',
    'updateDate': datetime(2015, 1, 1),
    'loggingConfiguration': {
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    'tracingConfiguration': {
        'enabled': True|False
    }
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

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

    • name (string) --

      The name of the state machine associated with the execution.

    • 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 for the execution.

    • updateDate (datetime) --

      The date and time the state machine associated with an execution was updated. For a newly created state machine, this is the creation date.

    • 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 AWS 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 AWS X-Ray tracing is enabled.

      • enabled (boolean) --

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

StartExecution (updated) Link ¶
Changes (request)
{'traceHeader': 'string'}

Starts a state machine execution.

Note

StartExecution is idempotent. If StartExecution is called with the same name and input as a running execution, the call will succeed and return the same response as the original request. If the execution is closed or if the input is different, it will return a 400 ExecutionAlreadyExists error. Names can be reused after 90 days.

See also: AWS API Documentation

Request Syntax

client.start_execution(
    stateMachineArn='string',
    name='string',
    input='string',
    traceHeader='string'
)
type stateMachineArn

string

param stateMachineArn

[REQUIRED]

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

type name

string

param name

The name of the execution. This name must be unique for your AWS account, region, and state machine for 90 days. For more information, see Limits Related to State Machine Executions in the AWS Step Functions Developer Guide .

A name must not contain:

  • white space

  • brackets < > { } [ ]

  • wildcard characters ? *

  • special characters " # % \ ^ | ~ ` $ & , ; : /

  • control characters ( U+0000-001F , U+007F-009F )

To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

type input

string

param input

The string that contains the JSON input data for the execution, for example:

"input": "{\"first_name\" : \"test\"}"

Note

If you don't include any JSON input data, you still must include the two braces, for example: "input": "{}"

Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

type traceHeader

string

param traceHeader

Passes the AWS X-Ray trace header. The trace header can also be passed in the request payload.

rtype

dict

returns

Response Syntax

{
    'executionArn': 'string',
    'startDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • executionArn (string) --

      The Amazon Resource Name (ARN) that id entifies the execution.

    • startDate (datetime) --

      The date the execution is started.

UpdateStateMachine (updated) Link ¶
Changes (request)
{'tracingConfiguration': {'enabled': 'boolean'}}

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.

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

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
    }
)
type stateMachineArn

string

param stateMachineArn

[REQUIRED]

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

type definition

string

param definition

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

type roleArn

string

param roleArn

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

type loggingConfiguration

dict

param loggingConfiguration

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 AWS 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 :*

type tracingConfiguration

dict

param tracingConfiguration

Selects whether AWS X-Ray tracing is enabled.

  • enabled (boolean) --

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

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • updateDate (datetime) --

      The date and time the state machine was updated.