Skip to content

Instantly share code, notes, and snippets.

@pubudusj
Last active June 8, 2022 10:33
Show Gist options
  • Save pubudusj/36df41c7b0d4cd6a838fd0708b8056a0 to your computer and use it in GitHub Desktop.
Save pubudusj/36df41c7b0d4cd6a838fd0708b8056a0 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: new lambda.Version(this, 'LambdaFunctionOneVersion', {
lambda: lambdaFunctionOne,
})
})
.next(waitForXMinutes)
.next(
new tasks.LambdaInvoke(this, 'TriggerLambdaFunctionTwo', {
lambdaFunction: new lambda.Version(this, 'LambdaFunctionTwoVersion', {
lambda: lambdaFunctionTwo,
})
})
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment