interface LambdaInvokeProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.StepFunctions.Tasks.LambdaInvokeProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctionstasks#LambdaInvokeProps |
![]() | software.amazon.awscdk.services.stepfunctions.tasks.LambdaInvokeProps |
![]() | aws_cdk.aws_stepfunctions_tasks.LambdaInvokeProps |
![]() | 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
Name | Type | Description |
---|---|---|
lambda | IFunction | Lambda function to invoke. |
assign? | { [string]: any } | Workflow variables to store in this step. |
client | string | Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function. |
comment? | string | A comment describing this state. |
credentials? | Credentials | Credentials for an IAM Role that the State Machine assumes for executing the task. |
heartbeat? | Duration | Timeout for the heartbeat. |
heartbeat | Timeout | Timeout for the heartbeat. |
input | string | JSONPath expression to select part of the state to be the input to this state. |
integration | Integration | AWS Step Functions integrates with services directly in the Amazon States Language. |
invocation | Lambda | Invocation type of the Lambda function. |
output | string | JSONPath expression to select part of the state to be the output to this state. |
outputs? | any | Used to specify and transform output from the state. |
payload? | Task | The JSON that will be supplied as input to the Lambda function. |
payload | boolean | Invoke the Lambda in a way that only returns the payload response without additional metadata. |
qualifier? | string | Version or alias to invoke a published version of the function. |
query | Query | The name of the query language used by the state. |
result | string | JSONPath expression to indicate where to inject the state's output. |
result | { [string]: any } | The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. |
retry | boolean | Whether to retry on Lambda service exceptions. |
state | string | Optional name for this state. |
task | Timeout | Timeout for the task. |
timeout? | Duration | Timeout for the task. |
lambdaFunction
Type:
IFunction
Lambda function to invoke.
assign?
Type:
{ [string]: any }
(optional, default: Not assign variables)
Workflow variables to store in this step.
Using workflow variables, you can store data in a step and retrieve that data in future steps.
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)
A comment describing 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.
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: $)
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:
Integration
(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.
Depending on the AWS Service, the Service Integration Pattern availability will vary.
invocationType?
Type:
Lambda
(optional, default: InvocationType.REQUEST_RESPONSE)
Invocation type of the Lambda function.
outputPath?
Type:
string
(optional, default: $)
JSONPath expression to select part of the state to be the output to this state.
May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.
outputs?
Type:
any
(optional, default: $states.result or $states.errorOutput)
Used to specify and transform output from the state.
When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly.
payload?
Type:
Task
(optional, default: The state input (JSONata: '{% $states.input %}', JSONPath: '$'))
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.
queryLanguage?
Type:
Query
(optional, default: JSONPath)
The name of the query language used by the state.
If the state does not contain a queryLanguage
field,
then it will use the query language specified in the top-level queryLanguage
field.
resultPath?
Type:
string
(optional, default: $)
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.
retryOnServiceExceptions?
Type:
boolean
(optional, default: true)
Whether to retry on Lambda service exceptions.
This handles Lambda.ServiceException
, Lambda.AWSLambdaException
,
Lambda.SdkClientException
, and Lambda.ClientExecutionTimeoutException
with an interval of 2 seconds, a back-off rate
of 2 and 6 maximum attempts.
stateName?
Type:
string
(optional, default: The construct ID will be used as state name)
Optional name for this state.
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.