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
  1. Build your Flogo app (<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. Refer to Building the App for details on how to build an app.
  2. Add execution permission to the native Linux/amd64 executable file that you built. Run chmod +x <myApp>-linux_amd64
  3. 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 the aws-access-key is identical to the one configured in the Flogo UI for the selected AWS Connection. This is used for validation with the aws-access-key configured as part of the AWS Connection within the UI and the value provided here does not overwrite the aws-access-key used while designing the app.
    This approach of deploying to AWS Lambda works only on Linux platforms.
    If you are using a non-Linux environment to design, build and deploy your apps, then use this approach:
    1. Compress the executable file and name it <myApp>-linux_amd64.zip in preparation for deploying to AWS Lambda.
    2. Create your Lambda function with go1.x runtime using the AWS Lambda console.
    3. Upload the .zip from step 3 to the Lambda function being created.
    4. Name the function handler the same as your executable name, <myApp>-linux_amd64.
    Refer to the AWS documentation for more details.
    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
    where MyLambdaApp is the Lambda app name and
    MyLambdaApp-env.properties is the properties file name.
    All properties in the .properties or .json file are passed to Lambda as environment variables.

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

  • Build your Flogo App (<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.
  • Rename the flogo executable to bootstrap (This is mandatory as per new provided.al2 and provided.al2023 runtimes).
  • Zip the executable.
  • Zip 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