Deploying a Flow as a Lambda Function on AWS
After you have created the flow, you can deploy it as a Lambda function on AWS.
Before you begin
The flow should be configured with the ReceiveLambdaInvocation trigger.
To deploy a flow as a Lambda function on AWS:
- Procedure
- Build your
Flogo app (
<myApp>
) with theLinux/amd64
target. This is because Lambda deployments are Linux-based and building the binary forLinux/amd64
generates the appropriate artifact to deploy in your AWS Lambda function. Refer to "Building the App" section for details on how to build an app. - Add execution permission to the native
Linux/amd64
executable that you built. Runchmod +x <myApp>-linux_amd64
- You can deploy the
<myApp>-linux_amd64
in one of two ways:If you are using a Linux-environment to design, build, and deploy your apps, you can directly run the following command:<LambdaTriggerBinary> --deploy lambda --aws-access-key <secret_key>
For example,myApp-Linux64 --deploy lambda --aws-access-key xxxxxxxxx
Note: Make sure that theThis approach of deploying to AWS Lambda works only on Linux platforms.aws-access-key
is identical to the one configured in the Flogo Enterprise Web UI for the selected AWS Connection. This is used for validation with theaws-access-key
configured as part of the AWS Connection within the Web UI and the value provided here does not overwrite theaws-access-key
used while designing the app.If you are using a non-Linux environment to design, build and deploy your apps, then use this approach:- Compress the executable and name it
<myApp>-linux_amd64.zip
in preparation for deploying to AWS Lambda. - Create your Lambda function with go1.x runtime using the AWS Lambda console.
- Upload the
.zip
from step 3 to the Lambda function being created. - Name the function handler the same as your executable name,
<myApp>-linux_amd64
.
To override app properties used in a Lambda app during runtime, create a.properties
or.json
file containing the properties and their values to override, then use the command./<Lambda-app-name> --deploy --env-config <app-property-file-name>.properties
.
For example:./MyLambdaApp --deploy --env-config MyLambdaApp-env.properties
whereMyLambdaApp
is the Lambda app name andMyLambdaApp-env.properties
is the properties file name.
All properties in the.properties
or.json
file are passed to Lambda as environment variables. - Compress the executable and name it