# AWS Lambda

It's possible to interact with AWS Lambda functions via HTTP API and [Signature V4 signing](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) using the AWS Lambda datasource in UI Bakery.

In this article, we'll explore how you can firstly connect AWS Lambda and then execute an AWS Lambda function from UI Bakery action.

## Configuration

### Prerequisites

Before connecting your data source to UI Bakery, you need to take the following steps:

* [Enable Lambda function URL](#enabling-lambda-function-url).
* [Create a new IAM user](#creating-a-new-iam-user).
* [Generate Access key ID and Secret access key ID](https://docs.uibakery.io/reference/amazon-s3#generating-access-key-id-and-secret-access-key-id).

#### Enabling Lambda function URL

To execute Lambda function from UI Bakery, you first need to enable the function URL for it.

* If you're *creating a new function*, simply select the **Enable function URL** checkbox in the Advanced settings section.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F1rw8ZqbG5LxaZKuEb9kX%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-46fbad21629491e266f4d980c8972f0092d00c57_image%20(126)-min.png?alt=media&#x26;token=1eb7f7b3-0156-4541-a00a-656b64ee4444" alt=""><figcaption></figcaption></figure>

* If this is an *existing Lambda function*, navigate to the **Configuration** tab > **Function URL** and click the **Create function URL** button. \
  Select *AWS\_IAM* as the function's Auth type.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FFRI7rmNyPO2G6EeXposr%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-f69e9a878d2f9e89b739d333ef569a7d2a17ae48_image%20(47)-min.png?alt=media&#x26;token=b042902a-6371-4ec7-8ccd-d4c057765bc3" alt=""><figcaption></figcaption></figure>

Once the function URL is created, save it to be used later when configuring a UI Bakery action.

#### Creating a new IAM user

To create an IAM user, follow [this flow](https://docs.uibakery.io/reference/amazon-s3#creating-iam-user) - only select *AWSLambda\_FullAccess* in **Permissions policies.**

{% hint style="danger" %}
When running UI Bakery in the *Production* environment, we strongly recommend limiting IAM user's access only to the operations they are allowed to perform (for example, to access only specific Lambda functions). For more information, please refer to [this AWS doc](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html).
{% endhint %}

### Connecting the data source

After you've completed all the steps above, you can now proceed to connecting your AWS Lambda data source. Follow the instruction below:point\_down:

1. On the **Data sources** page, click **Connect**, and select *AWS Lambda* in the Data sources list.
2. Specify all the required credentials and paste the *Access key ID* and *Secret access key ID* that you've generated prior.
3. If necessary, use the function URL you created in the first step in the **Base URL** field.
4. Click **Test connection** to check whether the data source can be connected, and then click **Connect Datasource.**

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F7IsxrsKvtXWZVt1ZdcvF%2FCleanShot%202025-04-09%20at%2012.59.14%402x-min.png?alt=media&#x26;token=e28b53e0-4568-407e-becb-e0e950b8f628" alt=""><figcaption></figcaption></figure>

## Usage

### Executing AWS Lambda function from UI Bakery action

Once your datasource is configured, you can go to your project and open the *Actions* panel. There, create a new action of the [HTTP Request](https://docs.uibakery.io/reference/working-with-actions/http-request) type and select your AWS Lambda data source.

If you've added the *Base URL* when connecting your data source, leave the **URL** field in the *Request settings* blank. If not, add the **function URL** to the URL field.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FDn9uehKoIo2x9ZyQWget%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-16cd783b708d81fbd61bdd2856fcfa3ace58fb48_image%20(88)-min.png?alt=media&#x26;token=433a7428-eccb-4b95-972d-8f9060aa603d" alt=""><figcaption></figcaption></figure>

Once the action is configured, you can execute it, and, if successful, you can assign this action to the component you need.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FDV3P1wZeViyJMCZOZ8R1%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-97e28d9efc9938f19ace171eb735893b34407962_image%20(114)-min.png?alt=media&#x26;token=10f2f510-88b5-4a17-9726-ab7d48dccd31" alt=""><figcaption></figcaption></figure>
