About this blueprint
AWS Serverless
This flow invokes multiple AWS lambda functions in parallel. It demonstrates how you can:
- Invoke a Lambda function based on its ARN, including invoking a specific
version
oralias
of your function - Easily pass custom
functionPayload
in a simple dictionary format - Access the output of the Lambda result JSON payload and extract relevant data using
jq
To test this blueprint, you can create a simple function, e.g. in Python, named demo
as follows:
python
import json
def lambda_handler(event, context):
print(event)
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
And another one named ResultHandler
:
python
import json
def lambda_handler(event, context):
function_result = event['your_event_input']
return {
'body': json.dumps(function_result + ' from Kestra')
}
You can then create a custom version or alias for your function, if needed.
yaml
id: aws_lambda
namespace: company.team
tasks:
- id: parallel
type: io.kestra.plugin.core.flow.Parallel
tasks:
- id: lambda
type: io.kestra.plugin.aws.lambda.Invoke
functionArn: arn:aws:lambda:eu-central-1:123456789:function:demo
- id: lambda_version
type: io.kestra.plugin.aws.lambda.Invoke
functionArn: arn:aws:lambda:eu-central-1:123456789:function:ResultHandler:1
functionPayload:
your_event_input: hello
- id: lambda_alias
type: io.kestra.plugin.aws.lambda.Invoke
functionArn: arn:aws:lambda:eu-central-1:123456789:function:ResultHandler:kestra
functionPayload:
your_event_input: hey there
- id: lambda_result
type: io.kestra.plugin.scripts.shell.Commands
runner: PROCESS
commands:
- cat {{ outputs.lambda.uri }} | jq -r '.body'