aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvokeProps

interface LambdaInvokeProps

LanguageType name
.NETAmazon.CDK.AWS.StepFunctions.Tasks.LambdaInvokeProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctionstasks#LambdaInvokeProps
Javasoftware.amazon.awscdk.services.stepfunctions.tasks.LambdaInvokeProps
Pythonaws_cdk.aws_stepfunctions_tasks.LambdaInvokeProps
TypeScript (source)aws-cdk-lib » aws_stepfunctions_tasks » LambdaInvokeProps

Properties for invoking a Lambda function with LambdaInvoke.

Example

declare const fn: lambda.Function;
new tasks.LambdaInvoke(this, 'Invoke with empty object as payload', {
  lambdaFunction: fn,
  payload: sfn.TaskInput.fromObject({}),
});

// use the output of fn as input
new tasks.LambdaInvoke(this, 'Invoke with payload field in the state input', {
  lambdaFunction: fn,
  payload: sfn.TaskInput.fromJsonPathAt('$.Payload'),
});

Properties

NameTypeDescription
lambdaFunctionIFunctionLambda function to invoke.
clientContext?stringUp to 3583 bytes of base64-encoded data about the invoking client to pass to the function.
comment?stringAn optional description for this state.
credentials?CredentialsCredentials for an IAM Role that the State Machine assumes for executing the task.
heartbeat?⚠️DurationTimeout for the heartbeat.
heartbeatTimeout?TimeoutTimeout for the heartbeat.
inputPath?stringJSONPath expression to select part of the state to be the input to this state.
integrationPattern?IntegrationPatternAWS Step Functions integrates with services directly in the Amazon States Language.
invocationType?LambdaInvocationTypeInvocation type of the Lambda function.
outputPath?stringJSONPath expression to select select a portion of the state output to pass to the next state.
payload?TaskInputThe JSON that will be supplied as input to the Lambda function.
payloadResponseOnly?booleanInvoke the Lambda in a way that only returns the payload response without additional metadata.
qualifier?⚠️stringVersion or alias to invoke a published version of the function.
resultPath?stringJSONPath expression to indicate where to inject the state's output.
resultSelector?{ [string]: any }The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
retryOnServiceExceptions?booleanWhether to retry on Lambda service exceptions.
taskTimeout?TimeoutTimeout for the task.
timeout?⚠️DurationTimeout for the task.

lambdaFunction

Type: IFunction

Lambda function to invoke.


clientContext?

Type: string (optional, default: No context)

Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function.


comment?

Type: string (optional, default: No comment)

An optional description for this state.


credentials?

Type: Credentials (optional, default: None (Task is executed using the State Machine's execution role))

Credentials for an IAM Role that the State Machine assumes for executing the task.

This enables cross-account resource invocations.

See also: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html


heartbeat?⚠️

⚠️ Deprecated: use heartbeatTimeout

Type: Duration (optional, default: None)

Timeout for the heartbeat.


heartbeatTimeout?

Type: Timeout (optional, default: None)

Timeout for the heartbeat.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface


inputPath?

Type: string (optional, default: The entire task input (JSON path '$'))

JSONPath expression to select part of the state to be the input to this state.

May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.


integrationPattern?

Type: IntegrationPattern (optional, default: IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.)

AWS Step Functions integrates with services directly in the Amazon States Language.

You can control these AWS services using service integration patterns

See also: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token


invocationType?

Type: LambdaInvocationType (optional, default: InvocationType.REQUEST_RESPONSE)

Invocation type of the Lambda function.


outputPath?

Type: string (optional, default: The entire JSON node determined by the state input, the task result, and resultPath is passed to the next state (JSON path '$'))

JSONPath expression to select select a portion of the state output to pass to the next state.

May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.


payload?

Type: TaskInput (optional, default: The state input (JSON path '$'))

The JSON that will be supplied as input to the Lambda function.


payloadResponseOnly?

Type: boolean (optional, default: false)

Invoke the Lambda in a way that only returns the payload response without additional metadata.

The payloadResponseOnly property cannot be used if integrationPattern, invocationType, clientContext, or qualifier are specified. It always uses the REQUEST_RESPONSE behavior.


qualifier?⚠️

⚠️ Deprecated: pass a Version or Alias object as lambdaFunction instead

Type: string (optional, default: Version or alias inherent to the lambdaFunction object.)

Version or alias to invoke a published version of the function.

You only need to supply this if you want the version of the Lambda Function to depend on data in the state machine state. If not, you can pass the appropriate Alias or Version object directly as the lambdaFunction argument.


resultPath?

Type: string (optional, default: Replaces the entire input with the result (JSON path '$'))

JSONPath expression to indicate where to inject the state's output.

May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.


resultSelector?

Type: { [string]: any } (optional, default: None)

The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.

You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.

See also: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector


retryOnServiceExceptions?

Type: boolean (optional, default: true)

Whether to retry on Lambda service exceptions.

This handles Lambda.ServiceException, Lambda.AWSLambdaException and Lambda.SdkClientException with an interval of 2 seconds, a back-off rate of 2 and 6 maximum attempts.

See also: https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html


taskTimeout?

Type: Timeout (optional, default: None)

Timeout for the task.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface


timeout?⚠️

⚠️ Deprecated: use taskTimeout

Type: Duration (optional, default: None)

Timeout for the task.