Invoke Named Lambda Function

Overview

The Invoke Named Lambda Function Action is used to execute an existing named Lambda function in the selected Context.

This action ensures targeted execution of Lambda functions, not covered by GorillaStack's Actions. It's used to incorporate custom functionality to address specific requirements and automates workflows that involve Lambda functions. For example, you could use it to trigger a Lambda function to send an email notification when a new file is uploaded to S3, or to trigger a Lambda function to update a DynamoDB table when a new customer record is created.

Use of this action in a rule

As part of a sequence of Actions, you may wish to inject some custom code to handle a special requirement not handled by GorillaStack.

In the Action configuration, you first select your Lambda function by name.

Next, you can specify execution settings including the:

  • Invocation Type (synchronous or asynchronous)
  • JSON Payload
  • Environment Variables

Getting Started

You can use the Action by setting up a rule.

You’ll also want to guarantee that you have created a Lambda function in the specified context that you can target by name.

Action Configuration

There are two tabs used to configure the Action:

  • Targeting - specify the name of your Lambda function to execute the right code.
  • Settings - select options that control how your Lambda functions should be executed.

Targeting

Function Name

The name of the function that you wish to target with this Action.

Settings

Invocation Type

This controls whether the Lambda function is invoked:

  • Synchronously - Lambda runs the function and waits for a response. Within a sequence of Actions, GorillaStack will wait for the targeted Lambda function to complete before continuing with the next Action in the sequence. (See AWS Lambda Docs for more details.)
  • Asynchronously - Lambda queues the event and a separate process will execute the function. The success response indicates that the event has been received, not that the function has yet executed. Your GorillaStack Action could complete before the function finishes, or even starts running. (See AWS Lambda Docs for more details.)

JSON Payload

You can pass a JSON payload along to your Lambda functions. GorillaStack also passes some Rule Execution data to your Lambda function, so that you can process information about the Context, Trigger and preceding Action results.

(See this specification on the schema of the JSON payload for more details.)

Environment Variables

With this setting, you can supplement or even optionally replace environment variables on your Lambda functions. Use this capability to inject configuration into your Lambda functions.

Specify your environment variables as key:value pairs, defining each variable’s name and value.

GorillaStack also provides a mechanism to set values as secrets. Selecting this checkbox will mask the value and prevent it being read after the Rule is saved. While we provide this to you, please be cautious of saving secrets in your Lambdas as environment variables. These can be read from your Lambda functions in plain text by anyone with privileges to view functions. Take a look for yourself aws lambda list-functions. (See AWS list-functions docs for more details.)