2023-06-06 13:21:08 -04:00
# Deploying a Connector Proxy as an AWS Lambda Function
2024-04-01 14:17:38 +00:00
This guide shows you how to deploy the demo `Connector Proxy` as an `AWS Lambda Function` and integrate it with [SpiffArena ](https://www.spiffworkflow.org/pages/spiffarena/ ).
We will use the [Getting Started Guide ](https://www.spiffworkflow.org/posts/articles/get_started/ ) as the basis for integration, but the steps should easily map to any custom installation.
2023-06-06 13:21:08 -04:00
2024-03-29 19:12:32 +00:00
It is assumed that you have access to log in to the AWS Console and can create/deploy Lambda functions.
2023-06-06 13:21:08 -04:00
2024-03-29 19:12:32 +00:00
## Building the Zip
2023-06-06 13:21:08 -04:00
2024-04-01 14:17:38 +00:00
One method of deploying a Lambda function is by uploading a zip file containing the source code or executable.
Run the following command in the root of [this repository ](https://github.com/sartography/connector-proxy-lambda-demo ):
2023-06-06 13:21:08 -04:00
```
make zip
```
2024-06-26 02:55:03 +00:00
This will create a zip file containing the [Lambda entry point function ](https://github.com/sartography/connector-proxy-lambda-demo/blob/main/connector_proxy_lambda_demo/lambda_function.py#L5 ) and all the dependencies needed to execute the connectors.
2024-04-01 14:17:38 +00:00
For this example, the libraries [spiffworkflow-proxy ](https://github.com/sartography/spiffworkflow-proxy ) for discovering connectors and [connector-http ](https://github.com/sartography/connector-http ), an example connector that provides HTTP get and post requests, are used.
2023-06-06 13:21:08 -04:00
2024-03-29 19:12:32 +00:00
Once `make zip` completes, `connector_proxy_lambda_demo.zip` will be available in the repository root.
2023-06-06 13:21:08 -04:00
## Creating the Lambda Function
2024-03-29 19:12:32 +00:00
Log in to the AWS Console and navigate to the Lambda section.
2023-06-06 13:21:08 -04:00

2024-03-29 19:12:32 +00:00
From there, choose `Create function` .
2023-06-06 13:21:08 -04:00

2024-03-29 19:12:32 +00:00
Opt for `Author from scratch` and select the most recent Python runtime.
2023-06-06 13:21:08 -04:00

2024-04-01 14:17:38 +00:00
Under `Advanced Settings` , check `Enable function URL` .
For this demo, we will use the `NONE` auth type to keep things simple.
2023-06-06 13:21:08 -04:00

2024-03-29 19:12:32 +00:00
After clicking the `Create function` button, you will be taken to your new Lambda function:
2023-06-06 13:21:08 -04:00

2024-04-01 14:17:38 +00:00
In the bottom right of the first section is a link to your Lambda's function URL.
Click it for a hello world response.
2023-06-06 13:21:08 -04:00

## Deploying the Lambda Function
2024-04-01 14:17:38 +00:00
If you scroll down, you will see a section with the example code created with your Lambda function.
We are going to replace this with the contents of our zip file.
Choose `Upload from` and select `.zip file` .
2023-06-06 13:21:08 -04:00

2024-06-26 02:55:03 +00:00
After a confirmation dialog, you will see that your Lambda has been updated:
2023-06-06 13:21:08 -04:00

2024-03-29 19:12:32 +00:00
Click your function URL again to see a greeting from our deployed Connector Proxy.
2023-06-06 13:21:08 -04:00
## Integrating With SpiffArena
2024-04-01 14:17:38 +00:00
Congratulations, your Connector Proxy has been deployed as a Lambda function.
For information on configuring SpiffArena to use the new Connector Proxy URL, please see [Configure a Connector Proxy ](configure_connector_proxy ).