Create AWS Serverless Infrastructure for GeneXus Serverless Application

Unofficial Content

When working with Serverless Apps, many components are needed to be created in the Cloud. An example of these components are:

  • Lambda functions for compute
  • API gateway for API hosting
  • CDN for Request Routing, CORS and HTTP Caching.
  • S3 Storage for Angular Applications
  • S3 Storage for private app data
  • Rewrites rules (for Angular Deployments)
  • Minimal user credentails for Deployment
  • IAM Roles 


An CDK (Infrastructure as code - IaC) is provided in order to automate Infrastructure creation.

The IaC source code is public and can be modified by the user if needed.


How to initialize a Serverless App Infrastructure for Serverless Deployments:



Create AWS Access Key and Secret Key for Deployment

For this, create a User (and AccessKeys) in AWS Console with the Following IAM permission policy (or just use an Administrator User)

    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": [
            "Resource": [

Run from the command line (CMD.exe):

1. Initial Project Setup

//Navigate to a folder of your preference  (ex: cd c:\temp\serverless)
npm i aws-cdk -g
git clone
cd gx-aws-cdk-samples/aws-serverless
npm install
npm run build

2. Configure AWS CLI for the current CMD Session

//Set you AWS Credentials
cdk bootstrap aws://ACCOUNT-NUMBER/AWS-REGION

3. Deploy Stack

//Set you AWS Credentials
cdk deploy --all --require-approval never


  • cdk bootstrap aws://ACCOUNT-NUMBER/AWS-REGION
    • ACCOUNT-NUMBER: Is your AWS Account Number.
    • AWS-Region: Is the AWS Region where you want to create de Stack. Must match "AWS_DEFAULT_REGION". 
    • Example: 
      • cdk bootstrap aws://123456789012/us-east-1
    • More info



Available Parameters (for cdk deploy command)

  • appname
    • Application Name
  • stage 
    • Stage Name for URL. Usually: v1, v2,v3
  • domain (optional)
    • Cloudfront Domain Name for Http Endpoints
  • certificateARN (optional)
    • AWS Certificate ARN required when using a domain. 
  • memory (optional)
    • Memory Size of Lambda Compute service (defaults: 1024MB)


You can change parameters in file cdk.json located in the root directory.

  "context": {
    "appname": "GXServerlessApp",
    "stage": "test"


Other Lambda predefined settings:

  • Lambda Function Timeout: 30 seconds
  • Lambda Runtime: Java Corretto 11


After executing the above commands, Cloud Infrastructure is created and basic outputs are printed to the Console. Those outputs are needed in order to Deploy From GeneXus IDE or MsBuild Tasks.

Sample output:

MyGeneXusServerlessApp.ServerlessAppaccessKey18458E8E = AKIAWJJT4NXXXX63
MyGeneXusServerlessApp.ServerlessAppapiName899AA174 = myTest
MyGeneXusServerlessApp.ServerlessAppapiUrl13CD1FA5 =
MyGeneXusServerlessApp.ServerlessAppmyTestapigwEndpoint9036D366 =
MyGeneXusServerlessApp.ServerlessApproleARN7A858545 = arn:aws:iam::XXXXXXXXXX:role/MyGeneXusServerlessApp-ServerlessAppmyTestla-S4JXVWBX7Q4K
MyGeneXusServerlessApp.ServerlessAppsecretKeyEE0B667A = EDINc64KBcy4ipzGXXXXXXSHF0MCeU24IOJUX
MyGeneXusServerlessApp.ServerlessAppstorageBucket7C6914DC = mygenexusserverlessapp-serverlessappmytestb-r03ed8rdbdit
MyGeneXusServerlessApp.ServerlessAppwebsiteBucketB6BBF9D7 = mygenexusserverlessapp-serverlessappmytestb-1qiheafyokggb


This output can also be seen from AWS Cloudformation Console:


Plase note that this information is needed by the GeneXus Deploy Tool/Serverless Properties.