# SfnStateMachine

Use a StepFunctions state machine as a target for Amazon EventBridge rules.

Extends: SfnStateMachine
Implements: IRuleTarget

- Source: [`aws-events-targets/lib/state-machine.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-events-targets/lib/state-machine.ts#L29)
- Type last changed: v2.235.0 · 15 Jan 2026

## Example

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

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(Duration.minutes(1)),
});

const dlq = new sqs.Queue(this, 'DeadLetterQueue');

const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.ServicePrincipal('events.amazonaws.com'),
});
const stateMachine = new sfn.StateMachine(this, 'SM', {
  definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(Duration.seconds(10)) })
});

rule.addTarget(new targets.SfnStateMachine(stateMachine, {
  input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
  deadLetterQueue: dlq,
  role: role
}));
```

## Initializer

```ts
new SfnStateMachine(machine: IStateMachine, props?: SfnStateMachineProps)
```

## Properties

- `machine`: [IStateMachine](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.IStateMachine.html)

## Methods

- `bind(rule: IRuleRef, _id?: string): RuleTargetConfig` — Returns a properties that are used in an Rule to trigger this State Machine.
