Class Workflow

The Workflow construct sets up an AWS Step Functions state machine with a specified definition file and IAM role. This construct facilitates the creation of a Step Functions workflow, including the definition from an S3 location and various configurations for logging and tracing. It implements the IGrantable interface for granting permissions.

Example

const workflow = new Workflow(this, 'MyWorkflow', {
definitionFileName: 'path/to/definition.asl.json',
stateMachineType: sfn.StateMachineType.STANDARD,
loggingConfiguration: {
level: sfn.LogLevel.ALL,
includeExecutionData: true,
destinations: [new logs.LogGroup(this, 'LogGroup')],
},
tracingConfiguration: {
enabled: true,
},
definitionSubstitutions: {
'${MyVariable}': 'MyValue',
},
});

const lambdaFunction = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_20_X,
handler: 'index.handler',
code: lambda.Code.fromAsset('lambda'),
});

workflow.grantPrincipal.grantInvoke(lambdaFunction);

Hierarchy

  • Construct
    • Workflow

Implements

  • IGrantable

Constructors

  • Creates an instance of Workflow.

    Parameters

    • scope: Construct

      The scope in which this construct is defined.

    • id: string

      The scoped construct ID.

    • props: WorkflowProps

      The properties of the Workflow construct.

    Returns Workflow

Properties

grantPrincipal: IPrincipal

The principal to which permissions can be granted.

node: Node

The tree node.

role: IRole

The IAM role assumed by the state machine.

workflowArn: string

The ARN of the created state machine.

Methods

  • Returns a string representation of this construct.

    Returns string

  • Checks if x is a construct.

    Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

    Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

    Parameters

    • x: any

      Any object

    Returns x is Construct

    true if x is an object created from a class which extends Construct.

Generated using TypeDoc