Source
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
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - cat {{ outputs.lambda.uri }} | jq -r '.body'
About this blueprint
CLI AWS
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
versionoraliasof your function
- Easily pass custom functionPayloadin 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.
More Related Blueprints
