Note:

You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . stepfunctions ]

test-state

Description

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 TestState API assumes an IAM role which must contain the required IAM permissions for the resources your state is accessing. For information about the permissions a state might need, see IAM permissions to test a state .

The TestState API can run for up to five minutes. If the execution of a state exceeds this duration, it fails with the States.Timeout error.

TestState doesn't support Activity tasks , .sync or .waitForTaskToken service integration patterns , Parallel , or Map states.

See also: AWS API Documentation

Synopsis

  test-state
--definition <value>
--role-arn <value>
[--input <value>]
[--inspection-level <value>]
[--reveal-secrets | --no-reveal-secrets]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]

Options

--definition (string)

The Amazon States Language (ASL) definition of the state.

--role-arn (string)

The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.

--input (string)

A string that contains the JSON input data for the state.

--inspection-level (string)

Determines the values to return when a state is tested. You can specify one of the following types:

  • INFO : Shows the final state output. By default, Step Functions sets inspectionLevel to INFO if you don't specify a level.
  • DEBUG : Shows the final state output along with the input and output data processing result.
  • TRACE : Shows the HTTP request and response for an HTTP Task. This level also shows the final state output along with the input and output data processing result.

Each of these levels also provide information about the status of the state execution and the next state to transition to.

Possible values:

  • INFO
  • DEBUG
  • TRACE

--reveal-secrets | --no-reveal-secrets (boolean)

Specifies whether or not to include secret information in the test result. For HTTP Tasks, a secret includes the data that an EventBridge connection adds to modify the HTTP request headers, query parameters, and body. Step Functions doesn't omit any information included in the state definition or the HTTP response.

If you set revealSecrets to true , you must make sure that the IAM user that calls the TestState API has permission for the states:RevealSecrets action. For an example of IAM policy that sets the states:RevealSecrets permission, see IAM permissions to test a state . Without this permission, Step Functions throws an access denied error.

By default, revealSecrets is set to false .

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command's default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

Output

output -> (string)

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

error -> (string)

The error returned when the execution of a state fails.

cause -> (string)

A detailed explanation of the cause for the error when the execution of a state fails.

inspectionData -> (structure)

Returns additional details about the state's execution, including its input and output data processing flow, and HTTP request and response information. The inspectionLevel request parameter specifies which details are returned.

input -> (string)

The raw state input.

afterInputPath -> (string)

The input after Step Functions applies the InputPath filter.

afterParameters -> (string)

The effective input after Step Functions applies the Parameters filter.

result -> (string)

The state's raw result.

afterResultSelector -> (string)

The effective result after Step Functions applies the ResultSelector filter.

afterResultPath -> (string)

The effective result combined with the raw state input after Step Functions applies the ResultPath filter.

request -> (structure)

The raw HTTP request that is sent when you test an HTTP Task.

protocol -> (string)

The protocol used to make the HTTP request.

method -> (string)

The HTTP method used for the HTTP request.

url -> (string)

The API endpoint used for the HTTP request.

headers -> (string)

The request headers associated with the HTTP request.

body -> (string)

The request body for the HTTP request.

response -> (structure)

The raw HTTP response that is returned when you test an HTTP Task.

protocol -> (string)

The protocol used to return the HTTP response.

statusCode -> (string)

The HTTP response status code for the HTTP response.

statusMessage -> (string)

The message associated with the HTTP status code.

headers -> (string)

The response headers associated with the HTTP response.

body -> (string)

The HTTP response returned.

nextState -> (string)

The name of the next state to transition to. If you haven't defined a next state in your definition or if the execution of the state fails, this field doesn't contain a value.

status -> (string)

The execution status of the state.