Deploy to AWS Lambda Function

Official Content
This documentation is valid for:

This document explains how to implement a GeneXus application as an AWS Lambda Functions.

Installation requirements

Download and run the AWS CLI MSI installer.

Setting up the cloud

  1. Create an AWS Account
  2. Create an IAM User with Access Keys

Modeling in GeneXus

Follow the steps below:

Note: In addition to configuring the AWS Profile name property, you need to consider the following:

  • Click on the Deploy button to implement in AWS.

Sample

As shown in the image, you can make the necessary settings for a timer-triggered function.

timer-triggeredAWSLambdafunction19082022

In this example, the AWS Profile name property is not set, so the AWS Access Key ID and AWS Secret Access Key properties are set instead.

Restrictions

  • Java Generator only (Highest JDK version supported: JDK11)
  • Multimedia content considerations
    • If using Image, Audio, Video, BlobFile data types => Storage Provider property must be used. This is because all App multimedia must be served from an external URL, such as Amazon S3.
    • FileSystem cannot be used to serve content: File/read write access as Blob data type, Excel, PDF Reports.
  • Temporal restrictions:
    • WebSession data type not supported (coming later)
    • KB Images not supported if returned from Server Side. For example: Procedure that Returns &Image.FromImage(MyKBImage).
  • Warning
    • DBMS Connection Pooling does not work in Serverless.
      • This is because Serverless executes one Lambda Function per Request. Therefore, every Lambda execution initializes a DB Pool. Thus, if 200 requests are received at the exact same time, 200 lambdas are woken up, and 200 connections to DB will be opened.

Architecture considerations

If the function app uses Image, Audio, Video, or BlobFile data types, you have to configure the Storage Provider property because all multimedia must be served from an external URL, such as Microsoft Azure or AWS S3.

For the same reason, using the file system to serve content is not supported; that is, to have read/write access to files (such as Blob data type, Excel, or PDF reports).

Under the hood

AWS Lambda functions are GeneXus applications that follow the structure required by the AWS Lambda Java engine.

An AWS Lambda GeneXus package looks as follows:

AnAWSLambdaGeneXusPackage19082022

Important notes:

  • “Lib” contains the required JAR files for the Application to run.
  • “com” contains the Java .class files.
  • “gx-awslambda-function.json”
    • Contains the Entry point that will be executed when the lambda is woken up by the runtime. **

**(This should be formatted as a CODE paragraph)

{"entryPointClassName": "com.myapp.eventdriven.queue.handlesqsuserqueueevent"}

Also, note that depending on the “Trigger Type” Deployment Property, GeneXus will assign the AWS Lambda Handler property accordingly.

AWSLambdaHandlerProperty19082022

  • For a SQS Triggered Function, the Lambda Handler name is: com.genexus.cloud.serverless.aws.handler.LambdaSQSHandler::handleRequest
  • For a Timer Triggered Function, the Lambda Handler name is: com.genexus.cloud.serverless.aws.handler.LambdaEventBridgeHandler::handleRequest
  • For an Event Bridge Triggered Function, the Lambda Handler name is: com.genexus.cloud.serverless.aws.handler.LambdaEventBridgeHandler::handleRequest
  • For an HTTP Triggered Function, the Lambda Handler name is: com.genexus.cloud.serverless.aws.handler.LambdaHttpApiHandler::handleRequest

This handler will be set automatically by GeneXus. However, in case of manual deployment, you will need to set the “Handler” accordingly.

Scope

Generators: Java

Availability

Since GeneXus 17 Upgrade 11.