> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superleap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Step-by-step guide to deploy the Superleap Appflow Lambda connector

Follow these steps to deploy the Superleap Appflow connector in your AWS account.

## Step 1: Create a Lambda Function

Create a new Lambda function in AWS. Choose **Python 3.12** as the runtime for compatibility.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/1%20Create%20Function.png" alt="Create Lambda function" />

## Step 2: Upload the Connector Code

Upload the [`superleap-connector-python.zip`](https://github.com/superleapai/superleap-appflow-connector-python-public/blob/v1.2.0/superleap-connector-python.zip) file to the Lambda function to overwrite the default Lambda code.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/2%20Upload%20superleap-connector-python.png" alt="Upload superleap-connector-python.zip" />

## Step 3: Create an IAM Policy

Go to **IAM → Policies** and create a new policy:

1. Choose **Secrets Manager** as the service
2. Add the **GetSecretValue** permission

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/3%20Create%20Policy%20from%20IAM.png" alt="Create Policy from IAM" />

3. Under **Specify ARNs**, choose your region and set the resource secret format to:

```
appflow!{account_id}-Superleap-*
```

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/4%20Specify%20ARNs.png" alt="Specify ARNs" />

4. Add a name and description, then create the policy

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/5%20Create%20Policy.png" alt="Create Policy" />

## Step 4: Navigate to the Lambda Execution Role

Go to the Lambda function → **Configuration** → **Permissions** → click on the **Role name** shown there. This will take you to the IAM role used by the Lambda function.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/6%20lambda%20configuration%20permission.png" alt="Lambda configuration permission" />

## Step 5: Attach the IAM Policy to the Role

1. Click **Add permission** and attach the policy created in Step 3 to the role

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/7%20Add%20permission%20and%20attach.png" alt="Add permission and attach" />

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/8%20Attach%20policy%20to%20the%20role.png" alt="Attach policy to the role" />

2. Confirm the permission is reflected in the Lambda function's permissions as well

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/9%20Confirm%20permission%20in%20lambda.png" alt="Confirm permission in Lambda" />

## Step 6: Set the Lambda Handler

Edit the **Handler** under **Runtime Settings**:

1. Set the runtime to **Python 3.12**

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/10%20Edit%20Handler.png" alt="Edit Handler" />

2. Set the handler to:

```
custom_connector_superleap.handlers.lambda_handler.superleap_lambda_handler
```

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/11%20Set%20Handler%20As.png" alt="Set Handler" />

## Step 7: Create and Add a Lambda Layer

1. Go to **Lambda → Layers** and create a new layer
2. Upload the [`python.zip`](https://github.com/superleapai/superleap-appflow-connector-python-public/blob/v1.2.0/python.zip) file
3. Set the compatible runtime to **Python 3.12** and architecture to **x86\_64**

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/12%20Create%20a%20layer.png" alt="Create a layer" />

4. Go back to the Lambda function, scroll down to **Layers**, and click **Add a layer**

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/13%20Add%20layer.png" alt="Add layer" />

5. Choose **Custom layers** and select the layer created above

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/14%20Choose%20custom%20layer.png" alt="Choose custom layer" />

## Step 8: Add a Resource-Based Policy

In the Lambda function, scroll down to **Resource-based policy statements** and add a new permission:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/15%20Resource%20Based%20Policy.png" alt="Resource-based policy" />

* **Principal**: `appflow.amazonaws.com`
* **Action**: `lambda:InvokeFunction`

<img src="https://mintlify.s3.us-west-1.amazonaws.com/superleap/images/appflow/16%20Add%20Principal.png" alt="Add Principal" />

Save the policy.

***

Once these steps are complete, proceed to [Configuration](/appflow/configuration) to register the connector in AppFlow and create your first flow.
