aws-lambda-step-function - AWS Solutions Constructs

aws-lambda-step-function

All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.

Language Package
Python
aws_solutions_constructs.aws_lambda_step_function
Typescript
@aws-solutions-constructs/aws-lambda-step-function
Java
software.amazon.awsconstructs.services.lambdastepfunction

This AWS Solutions Constructs pattern implements an AWS Lambda function connected to an AWS Step Functions state machine.

Here is a minimal deployable pattern definition:

const { LambdaToStepFunction } = require('@aws-solutions-constructs/aws-lambda-step-function'); new LambdaToStepFunction(stack, 'LambdaToStepFunctionPattern', { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_12_X, handler: 'index.handler', code: lambda.Code.asset(`${__dirname}/lambda`) }, stateMachineProps: { definition: startState } });

Initializer

new LambdaToStepFunction(scope: Construct, id: string, props: LambdaToStepFunctionProps);

Parameters

Pattern Construct Props

Name Type Description
existingLambdaObj? lambda.Function An optional, existing Lambda function to be used instead of the default function. If an existing function is provided, the lambdaFunctionProps property will be ignored.
lambdaFunctionProps? lambda.FunctionProps Optional user-provided properties to override the default properties for the Lambda function. Ignored if an existingLambdaObj is provided.
stateMachineProps sfn.StateMachineProps User provided props for the sfn.StateMachine.

Pattern Properties

Name Type Description
cloudwatchAlarms cloudwatch.Alarm[] Returns a list of one or more CloudWatch alarms created by the pattern.
lambdaFunction lambda.Function Returns an instance of the Lambda function created by the pattern.
stateMachine sfn.StateMachine Returns an instance of the state machine created by the pattern.
stateMachineLogGroup logs.LogGroup Returns an instance of the log group created by the pattern for the state machine.

Default settings

Out-of-the-box implementation of this pattern without any overrides will set the following defaults:

AWS Lambda Function

  • Configure a least-privilege access IAM role for the Lambda function.

  • Enable reusing connections with Keep-Alive for NodeJs Lambda functions.

AWS Step Functions State Machine

  • Deploy best-practice CloudWatch alarms for the AWS Step Functions State Machine.

Architecture