@axway-api-builder-ext/api-builder-plugin-fn-aws-lambda

Invoke AWS Lambda functions from within your API-Builder flow.

Usage no npm install needed!

<script type="module">
  import axwayApiBuilderExtApiBuilderPluginFnAwsLambda from 'https://cdn.skypack.dev/@axway-api-builder-ext/api-builder-plugin-fn-aws-lambda';
</script>

README

AWS Lambda Tests

API-Builder AWS-Lambda Flow-Node

If you would like to integrate AWS Lambda functions into your API-Builder flow use this flow node. It allows you to easily call your Lambda-Functions and merge, transform or use the returned data in any way you want.

Watch this video to see the AWS-Lambda connector in action:
Install AWS-Lambda Connector

Configuration

After installation and restarting your API-Builder project you get the following new flow-node:
Node
Before you can make use it in your flow you have to configure your AWS-Credentials allowed to invoke Lambda functions.

During installation a new config file has been automatically created which must be completed with your AWS Credentials. You can do that directly from within the API-Builder UI:
Config
We recommend to setup your configuration in a environmentalized way keeping sensitive information away from the source-code repository.

Invoke Lambda functions

To invoke a Lambda function, just drag & drop the Flow-Node into your flow and set it up as described here.
Node

Input parameters

Param Type Required Description
func string y The name of the AWS-Lambda-Function to call.
payload JSON or Object n Input information required by the Lambda-Function. Example: {"key1":"value1"}
asynchronous boolean n If enabled the Lambda function is invoked asyncronously and no data is returned. Read more here: https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html.
logResult boolean n If enabled, the Tail option is used when invoking the Lambda function and logged in the API Builder Console.

Output

If the function wasn't invoked asynchronously you get back the data.Payload into attribute configured with next. By default: $.result. For example, having the following AWS-Lambda function:

exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        body: "Hello from " + event.key1 + " from AWS-Lambda!"
    };
    return response;
};

Using the payload: {"key1":"Chris"} the attribute $.result will contain the following: Howdy Hello from Chris from AWS-Lambda!.
In case of an error the attribute: $.error contains the error returned by AWS or by the Lambda-Fow-Node.

If the function is invoked asynchronously no data is returned. The attribute: $.result just contains the value: Accepted.

Compatibility

Tested with AWS Lambda Q1/2020
Requires API-Builder Independence or higher

Changelog

See Change-Log

Limitations/Caveats

Nothing known

Contributing

Please read Contributing.md for details on our code of conduct, and the process for submitting pull requests to us.

Team

alt text Axway Team