1. Home
  2. FlexRule CLI
  3. CLI Scenarios
  4. Deploy your Models to AWS Functions through CLI

Deploy your Models to AWS Functions through CLI

◷ Reading Time: 4 minutes

In this page we are going to use the FlexRule CLI to publish a FlexRule project and then deploy it to the AWS. There are two approaches to publish:

Clone a project from GitHub

Run Command Prompt as administrator and navigate to a folder where you want to clone your project from GitHub repository .

git clone <reposiory-url>

Publish your Project

Navigate to FlexRule CLI installation folder and execute the publish command to publish your cloned project from Git Hub.

cd <FlexRuleCLI installationfolder location> 

Using Logic Document

One of the approaches is to publish your project using Logic Document.

fr.exe publish --project "D:projectsPublish-Profile-with-Delivery-Cost-CalculatorDelivery Cost Calculator.frpj" --method package --destination "D:projectsPublishDeliveryCost.frdp" --includeAssemblies True --runtime "C:\Users\<user-name>\Documents\.flexrule9.0.201" --logic "Calculator.xml" --packageidentifier "1" --packageversion "1" --serviceversion "1"

Using Publish Profile Document

Another approach is to publish your project using Publish Profile Document.

fr.exe publish --project "D:projectsPublish-Profile-with-Delivery-Cost-CalculatorDelivery Cost Calculator.frpj" --method package --destination "D:projectsPublishDeliveryCost.frdp" --includeAssemblies True --runtime "C:\Users\<user-name>\Documents\flexrule9.0.201" --profile "Profile.xml" --packageidentifier "1" --packageversion "1" --serviceversion "1"

It will create a .frdp file in your selected destination.

Deploy

Deploy your published .frdp file into AWS using deploy command.

fr.exe deploy --to AWS --package "D:projectsPublishDeliveryCost.frdp" --license "D:AWS Credentialsflexrule.license (3).lic" --includeassemblies true --runtime "C:\Users\<user-name>\Documents\flexrule9.0.201" --includeassemblies true --function DeliveryCost --accesskeyid xxxx --secret xxxx  --region xxxx --bucket xxxx 

Test

After a successful deployment you will get a Execute URL and Service URL on the CLI screen to access your deployment.

In here we will be using Postman to test the deployed package.

Accessing the Package using Execute URL

CLI AWS

The invocationId is generated as {RequestId}.{RunId} where the RequestId comes from the cloud platform for the function, and RunId comes from FlexRule engine executing a specific request.

Accessing the Swagger Endpoint using Service URL

Updated on December 2, 2022

Was this article helpful?

Related Articles