# StateMachineProps

Properties for defining a State Machine.

Used as props by: [StateMachine](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachine.html)

- Source: [`aws-stepfunctions/lib/state-machine.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts#L96)
- Type last changed: v2.221.1 · 29 Oct 2025

## Example

TypeScript:

```ts
import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions';

const pipeline = new codepipeline.Pipeline(this, 'MyPipeline');
const inputArtifact = new codepipeline.Artifact();
const startState = new stepfunctions.Pass(this, 'StartState');
const simpleStateMachine  = new stepfunctions.StateMachine(this, 'SimpleStateMachine', {
  definition: startState,
});
const stepFunctionAction = new codepipeline_actions.StepFunctionInvokeAction({
  actionName: 'Invoke',
  stateMachine: simpleStateMachine,
  stateMachineInput: codepipeline_actions.StateMachineInput.filePath(inputArtifact.atPath('assets/input.json')),
});
pipeline.addStage({
  stageName: 'StepFunctions',
  actions: [stepFunctionAction],
});
```

Python:

```python
import aws_cdk.aws_stepfunctions as stepfunctions

pipeline = codepipeline.Pipeline(self, "MyPipeline")
input_artifact = codepipeline.Artifact()
start_state = stepfunctions.Pass(self, "StartState")
simple_state_machine = stepfunctions.StateMachine(self, "SimpleStateMachine",
    definition=start_state
)
step_function_action = codepipeline_actions.StepFunctionInvokeAction(
    action_name="Invoke",
    state_machine=simple_state_machine,
    state_machine_input=codepipeline_actions.StateMachineInput.file_path(input_artifact.at_path("assets/input.json"))
)
pipeline.add_stage(
    stage_name="StepFunctions",
    actions=[step_function_action]
)
```

Java:

```java
import software.amazon.awscdk.services.stepfunctions.*;

Pipeline pipeline = new Pipeline(this, "MyPipeline");
Artifact inputArtifact = new Artifact();
Pass startState = new Pass(this, "StartState");
StateMachine simpleStateMachine = StateMachine.Builder.create(this, "SimpleStateMachine")
        .definition(startState)
        .build();
StepFunctionInvokeAction stepFunctionAction = StepFunctionInvokeAction.Builder.create()
        .actionName("Invoke")
        .stateMachine(simpleStateMachine)
        .stateMachineInput(StateMachineInput.filePath(inputArtifact.atPath("assets/input.json")))
        .build();
pipeline.addStage(StageOptions.builder()
        .stageName("StepFunctions")
        .actions(List.of(stepFunctionAction))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.StepFunctions;

var pipeline = new Pipeline(this, "MyPipeline");
var inputArtifact = new Artifact();
var startState = new Pass(this, "StartState");
var simpleStateMachine = new StateMachine(this, "SimpleStateMachine", new StateMachineProps {
    Definition = startState
});
var stepFunctionAction = new StepFunctionInvokeAction(new StepFunctionsInvokeActionProps {
    ActionName = "Invoke",
    StateMachine = simpleStateMachine,
    StateMachineInput = StateMachineInput.FilePath(inputArtifact.AtPath("assets/input.json"))
});
pipeline.AddStage(new StageOptions {
    StageName = "StepFunctions",
    Actions = new [] { stepFunctionAction }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"

pipeline := codepipeline.NewPipeline(this, jsii.String("MyPipeline"))
inputArtifact := codepipeline.NewArtifact()
startState := stepfunctions.NewPass(this, jsii.String("StartState"))
simpleStateMachine := stepfunctions.NewStateMachine(this, jsii.String("SimpleStateMachine"), &StateMachineProps{
	Definition: startState,
})
stepFunctionAction := codepipeline_actions.NewStepFunctionInvokeAction(&StepFunctionsInvokeActionProps{
	ActionName: jsii.String("Invoke"),
	StateMachine: simpleStateMachine,
	StateMachineInput: codepipeline_actions.StateMachineInput_FilePath(inputArtifact.AtPath(jsii.String("assets/input.json"))),
})
pipeline.AddStage(&StageOptions{
	StageName: jsii.String("StepFunctions"),
	Actions: []IAction{
		stepFunctionAction,
	},
})
```

## Properties

- `comment`: string — Comment that describes this state machine.

  **Default:** No comment

- `definition`: [IChainable](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.IChainable.html) — use definitionBody: DefinitionBody.fromChainable()

- `definitionBody`: [DefinitionBody](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.DefinitionBody.html) — Definition for this state machine.

- `definitionSubstitutions`: { [key: string]: string } — substitutions for the definition body as a key-value map.

- `encryptionConfiguration`: [EncryptionConfiguration](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.EncryptionConfiguration.html) — Configures server-side encryption of the state machine definition and execution history.

  **Default:** data is transparently encrypted using an AWS owned key

- `logs`: [LogOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.LogOptions.html) — Defines what execution history events are logged and where they are logged.

  **Default:** No logging

- `queryLanguage`: [QueryLanguage](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.QueryLanguage.html) = JSON_PATH — The name of the query language used by the state machine.

  If the state does not contain a `queryLanguage` field,
  then it will use the query language specified in this `queryLanguage` field.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — The removal policy to apply to state machine.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The execution role for the state machine service.

  **Default:** A role is automatically created

- `stateMachineName`: string — A name for the state machine.

  **Default:** A name is automatically generated

- `stateMachineType`: [StateMachineType](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachineType.html) = StateMachineType.STANDARD — Type of the state machine.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Maximum run time for this state machine.

  **Default:** No timeout

- `tracingEnabled`: boolean = false — Specifies whether Amazon X-Ray tracing is enabled for this state machine.
