Deploying a Flow as a Lambda Function on AWS
Note: The information in this section is applicable for an app executable only.
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 for details on how to build an app. - Add execution permission to the native
Linux/amd64
executable file 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 UI for the selected AWS Connection. This is used for validation with theaws-access-key
configured as part of the AWS Connection within the 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 file 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 file and name it
Push the app to the cloud. Doing so deploys the function to the AWS server. After the function has been deployed, whenever the function is invoked, you can view the logs in the Logs page.
Deploying a Flow as a Lambda Function on AWS using AWS CLI
<myApp>
) with the
Linux/amd64
target. This is because Lambda deployments are Linux-based and building the binary for Linux/amd64
generates the appropriate artifact to deploy in your AWS Lambda function. provided.al2
and provided.al2023
runtimes).myFunction.zip
bootstrap.Run the AWS CLI:
aws lambda create-function --function-name myFunction \ --runtime provided.al2023 --handler bootstrap \ --architectures x86_64 \ --role arn:aws:iam::111122223333:role/lambda-ex \ --region us-west-2 \ --zip-file fileb://myFunction.zip