Skip to content
v2.274.0

SfnStateMachineProps Struct ​

Customize the Step Functions State Machine target.

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
}));

Properties ​

deadLetterQueueoptionalIQueuedead_letter_queueoptionalIQueuedeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueue#
The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations).

Default: no dead-letter queue

notes

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.

inputoptionalRuleTargetInputinputoptionalRuleTargetInputinputoptionalRuleTargetInputInputoptionalRuleTargetInputInputoptionalRuleTargetInput#
The input to the state machine execution.

Default: the entire EventBridge event

maxEventAgeoptionalDurationmax_event_ageoptionalDurationmaxEventAgeoptionalDurationMaxEventAgeoptionalDurationMaxEventAgeoptionalDuration= Duration.hours(24)#
The maximum age of a request that Lambda sends to a function for processing.

Minimum value of 60. Maximum value of 86400.

retryAttemptsoptionalnumberretry_attemptsoptionalint | floatretryAttemptsoptionalNumberRetryAttemptsoptionaldoubleRetryAttemptsoptional*float64= 185#
The maximum number of times to retry when the function returns an error.

Minimum value of 0. Maximum value of 185.

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
The IAM role to be assumed to execute the State Machine.

Default: a new role will be created