Skip to content

Instantly share code, notes, and snippets.

@pubudusj
Created June 8, 2022 11:21
Show Gist options
  • Save pubudusj/209b685f2f47e669a6ccc47f763d072b to your computer and use it in GitHub Desktop.
Save pubudusj/209b685f2f47e669a6ccc47f763d072b to your computer and use it in GitHub Desktop.
const lambdaFunctionOne = new nodejs_lambda.NodejsFunction(this, "LambdaFunctionOne", {
runtime: lambda.Runtime.NODEJS_14_X,
entry: path.join(__dirname, `/../lambda/FunctionOne/index.ts`),
handler: "handler",
timeout: Duration.minutes(10),
});
const waitForXMinutes = new sfn.Wait(this, 'Wait', {
time: sfn.WaitTime.duration(Duration.minutes(3)),
});
const lambdaFunctionTwo = new nodejs_lambda.NodejsFunction(this, "LambdaFunctionTwo", {
runtime: lambda.Runtime.NODEJS_14_X,
entry: path.join(__dirname, `/../lambda/FunctionTwo/index.ts`),
handler: "handler",
timeout: Duration.minutes(10),
});
const stateMachine = new sfn.StateMachine(this, 'SfTestStateMachine', {
definition: new tasks.LambdaInvoke(this, 'TriggerLambdaFunctionOne', {
lambdaFunction: lambdaFunctionOne
})
.next(waitForXMinutes)
.next(
new tasks.LambdaInvoke(this, 'TriggerLambdaFunctionTwo', {
lambdaFunction: lambdaFunctionTwo
})
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment