This document tells you the prerequisites and steps to deploy applications (REST APIs) to AWS Lambda and AWS API Gateway.
"AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume - there is no charge when your code is not running." ref.: https://aws.amazon.com/lambda/
"Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale." ref.: https://aws.amazon.com/api-gateway
The main benefits of deploying to serverless platforms are the following:
- No worry about infrastructure at all.
- No need to manage, configure or install any web server.
- No need to rent or buy any server.
- 24/7/365 up time for (almost) free. (You pay only if the App is used. )
- AWS Lambda is used in order to Deploy Code that will be run in the Cloud.
- AWS API Gateway for Deploying REST Services.
- Swagger definition for describing the API generated for our Application.
- Deployment of SmartDevices Apps or REST Services. (Web Interface is not supported)
- Java Generator only (JDK1.8 must be used (JDK9 or higher not compatible))
- Requires AWS Account and AWS API Key
- Max number of 600 services can be deployed per AWS Region.
- 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.
- Not supported
- Cannot use FileSystem to serve content: File/read write access as Blob data type, Excel, PDF Reports.
- Web Interface Applications
- WebSession data type (It is stateless)
- Build your JAVA Application (SD APP or WebServices REST). JDK1.8 must be used (JDK9 or higher not compatible)
- Using Application Deployment tool, select the Main Objects to Deploy. It must be a SDApp, DataProvider or Procedure (with Expose as WebService = TRUE).
- From the Target Dropdown, select: "AWS Serverless Deploy"
- Fill AWS Access Key Id, AWS Secret Access Key*** and AWS Default Region
- Fill Application Name and Stage Name (ex: v1, v2, v3)
- Click "Deploy"
At the final step, GeneXus will print out the final URL.
You can use it now in the Smart Devices Generator's Services URL property.
Some important notes:
***AWS Access Key requires Custom Policy: IAM Serverless Policy for Serverless Deploy
The AWS Lambda Function deployed must have access to the Database (should be in the same VPC and Security Group). You will have to configure it manually in the AWS Lambda Function Console.
This feature is available as of GeneXus 16.