Trisotech's blog post - Invoking AWS Lambda functions
Trisotech Icon
Blog

Invoking AWS Lambda functions

By Trisotech

Read Time: 2 Minutes

You have created your own code in an AWS Lambda function in Python, Java, JavaScript or C# and want to integrate it with an automated workflow created in the Trisotech Digital Enterprise Suite?

This simple Python function says hello from the region it is deployed in with HTTP 200 as plain text.

AWS Lambda Function can be easily deployed but it is important to make sure that access to this function is restricted. This is where authentication comes into the picture. In this case it is going to be based on an API key that is assigned and provided to the consumers of this function. To be able to use API key-based authentication, the function needs to have a trigger based on API Gateway.

Adding API gateway is done via adding a trigger to the function. It is important to use the REST-API as the type and API key as security mode.

With API Gateway as trigger, this function will get assigned URL to invoke this function from outside. It will be in following format:

https://{xxxxxxxxxx}.execute-api.{region}.amazonaws.com/default/DESSample

where xxxxxxxxx and region are replaced with actual value based on AWS environment.

Additionally, there will be one API key created automatically and more API keys can be created in the configuration of the API Gateway. The API key needs to be provided as an HTTP header (named x-api-key) when invoking the function.

Trisotech Digital Modelling and Automation suites trivialize the orchestration of externally defined code with its low code approach if it’s exposed though a standard REST API that can be described using the OpenAPI (Swagger) standard.

The integration is done through a BPMN service task that invokes the lambda function.

The lambda function is referenced using the Operation Library that allows to define where the lambda function can be accessed, its parameters and its security constraints. Clicking on the service task gear will allow you to create a new Interface and Operation.

Name your Interface and configure it (using the pen icon) with:

  • Server URL – what is the server URL where this interface can be found
  • Security
    • Type: API Key
    • In: header
    • Name: x-api-key

Security section defines the mechanisms to authenticate when invoking the service. In this case, it uses API Key as defined in the API Gateway for the AWS Lambda function.

Name your Operation and configure it (using the pen icon) with:

  • Method – HTTP method that the request will use.
  • Path – context path in the server URL for the AWS Lambda function.
  • Outputs – data to be retrieved from the function.
    • result

This integration allows to invoke lambda functions written in any language, but also more complex services exposed through a REST API opening an infinite world of orchestration and integration using your existing or newly created functions and services.

Trisotech also offer an Automation Cookbook as part of the Digital Automation Suite that contains a lot of other recipes to integrate systems and with its automation capabilities.

All Blog Articles

Read our experts’ blog

View all

Learn how it works

Request Demo

Confirm your budget

Request Pricing

Discuss your project

Request Meeting
Graph