How to Deploy as an AWS Lambda

◷ Reading Time: 7 minutes

You can deploy a project as an AWS Lambda. By doing this, you can get the service URL of your project without needing to install FlexRule Server.

We are deploying this Decision Table as an example. It takes a person’s age as an input and outputs the title according to the age range.

This is the input object of the decision table.

{
     "person":
     {
         "Age":0,
         "Title":null
     }
 }

The complete project is attached at the end of the page.

How to Deploy

Open the Project’s Entry Document

Open your project’s entry document.
In this example, the decision table is the entry document.

Open Package Builder

Click on the Package Builder.

Add your package details such as,

  • Package identifier
  • Package version
  • Service version
Go to the Deployment tab and select AWS Lambda.

Enter AWS subscription details. For more information about Access Keys refer to How to retrieve AWS Access Key Id and Access Key Secret.

Optionally, you can create a JSON according to the following template and save it as a JSON file (.json). Then use the buttonto upload the created JSON file with AWS subscription details.
{
"AccessKeyId" : "xxxxxxxxxxx",
"AccessKeySecret" : "xxxxxxxxxxxx",
"Bucket" : "xxxxxxxx",
"Region" : "xxxxxxxxx"
}


If the specified Bucket doesn’t exist yet, it will create a new one under the selected region. For Bucket, naming rules refer to this link.

Select the Runtime license file. The Runtime folder will be automatically taken from the Runtime path you have defined in your project.

Click Publish.

Once the package was created successfully, you will see a confirmation message.

The deployment will happen in the background. On the background task window, you will see the list of deployment tasks.

The complete list of deployment tasks can be seen along with their status.

If there are any errors, you can see the specific task(s) with the error(s).

Select the errored task and click on View Task Result to see the detailed exception.

Once the deployment is completed you can see the completed status with the icon .

View Deployment URLs

Click on View Task Result to see the results.

You will receive the URLs of the successful deployment.

  • Execute Url: The URL to be used to call the service
    e.g.
    https://u6cfjz8w2m.execute-api.ca-central-1.amazonaws.com/Prod/Execute/age-service/1/person_growing_state/1?code=ejpNREy7nj9xOrz1+xQGd3pLERVqJ78YeAnVrAXSj/Smh+ZQ1u8xOi0d+0bU7DEWju81f9kgrVmtovpAa9cbGg==
  • Package Name Url: Retrieve the list of naming applications with the same package name
    e.g.
    https://u6cfjz8w2m.execute-api.ca-central-1.amazonaws.com/Prod/Services/age-service/?code=H7i9B5+r4xy2ls/a/GkqRM5jQE7ytVN1pmKzf+qNeb9jn0Ju0rMD3UUu3DTAcV4ngufiS6pk9rUhmww/RimetA==
  • Package Version Url: Retrieve the list of naming applications with the same package name and Package version
    e.g.
    https://u6cfjz8w2m.execute-api.ca-central-1.amazonaws.com/Prod/Services/age-service/1/?code=H7i9B5+r4xy2ls/a/GkqRM5jQE7ytVN1pmKzf+qNeb9jn0Ju0rMD3UUu3DTAcV4ngufiS6pk9rUhmww/RimetA==
  • Service Version Url: Retrieve the list of parameters
    e.g.
    https://u6cfjz8w2m.execute-api.ca-central-1.amazonaws.com/Prod/Services/age-service/1/person-growing-state/1?code=H7i9B5+r4xy2ls/a/GkqRM5jQE7ytVN1pmKzf+qNeb9jn0Ju0rMD3UUu3DTAcV4ngufiS6pk9rUhmww/RimetA==
  • Services Url: Retrieve the list of available services
    e.g.
    https://u6cfjz8w2m.execute-api.ca-central-1.amazonaws.com/Prod/Services/?code=H7i9B5+r4xy2ls/a/GkqRM5jQE7ytVN1pmKzf+qNeb9jn0Ju0rMD3UUu3DTAcV4ngufiS6pk9rUhmww/RimetA==

Update an Existing App

Once you deploy a service, you can use the following options to update the service.

First, specify the new service version. This should be different from the version you have First, specify the new Service Version. This should be different from the service version you have already deployed. The Identifier and its Version should be similar to the previous version.

Then add the following information under Deployment.

  • Update App: Select this if you want to update an app
  • Lambda Name: The name of the app (Copy the name from AWS API Gateway without the -API part)
  • API ID: AWS API Gateway ID
  • Set as Default: If you want to set the version that you are about to publish as default, select this

Lambda Name and API ID can be found on AWS API Gateway.

Once the re-deployment is completed successfully, you can access the new version.

Note that the default version does not specify a service version. We set it to the latest deployment version.

https://nd2n7dbvf7.execute-api.us-west-2.amazonaws.com/Prod/Execute/age-service/1/person_growing_state/?code=o5FnUklE0O4mLqp87hIShGP8MuS3pbyrRCdjNuZrq/360e0h0m1bYg9sxvjrCDPbcpkkQ9EMVeByFk8i8drVPA== 
Updated on March 28, 2023

Article Attachments

Was this article helpful?

Related Articles