# 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](/reference/data-sources/amazon-s3.md#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="/files/js78zOw0qoPAIe0TVh4e" 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="/files/dlk3N9QdpTrE8KnUtEN7" 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](/reference/data-sources/amazon-s3.md#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="/files/oRlGy1cMj8QsPSwCqcAD" 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](/reference/working-with-actions/http-request.md) 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="/files/Mi0DjKnZJxyuNJKA4KRY" 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="/files/GgfJ3OdtjXSc3k91p69z" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/reference/data-sources/aws-lambda.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
