AWS Lambda

Using the AWS Lambda datasource in UI Bakery it is possible to interact with AWS Lambda functions via HTTP API and Signature V4 signing.

Below you can find a tutorial that explains how to execute an AWS Lambda function from UI Bakery action.

Enabling lambda function URL

In order for a lambda function to be executed from UI Bakery, you need to enable the function URL for it.

If you are creating a new function, you can do that by clicking the checkbox in the Advanced Settings panel:

If this is an existing lambda function, you can do that by clicking the "Create function URL" button in function Configuration and selecting AWS_IAM as its Auth type:

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

Creating a new IAM user

First of all, you need to create a new IAM user with the appropriate permissions. Navigate to IAM and click the "Add users" button:

Enter the user name and click the Next button. At the next stage, you will need to specify appropriate permissions for your new user. Select "Attach policies directly" and type "Lambda" in the search bar. In the search results select "AwsLambdaFullAccess" from the list and click next.

When running UI Bakery in the production, environment, we strongly recommend limiting IAM users' access only to the operations they are allowed to perform (e.g. to accessing only specific lambda functions). For more information please refer to this AWS doc.

Review the details of your new user and click the "Create user" button.

Generate Access keys for IAM user

Once the IAM user is created, you need to create Access Key Id and Secret Access Key for UI Bakery to access the AWS API. On IAM > Users page click the details of the user and navigate to the "Security credentials" tab. Once there, scroll down to the Access Keys section and click the "Create Access Key" button.

When creating a new Access Key, select "Third-party service" as the Key type:

Click next and enter some description tag, for instance, "UI Bakery". At step 3 you will be provided with Access Key Id and Secret Access Key that you will need to configure your UI Bakery data source.

Configure UI Bakery AWS API data source

In your UI Bakery organization, go to Datasources tab, and click the "Connect Datasource" button. Once there, select AWS Lambda as the type of your datasource.

Paste the Access Key ID and Secret Access Key that you generated in the previous step to the appropriate fields. Configure the region where your function is located, for instance, us-west-2. You can use a function URL you created in the first step as a Base URL.

Click Test Connection, and Connect Datasource to create your AWS Lambda datasource.

Execute AWS Lambda function from UI Bakery action

Once your datasource is configured, go to your project and open the actions panel. Create a new action of type "HTTP Request" and select a Datasource you configured in the previous step.

If you configured the Base URL in the previous step, leave the URL blank. If not, use the function URL in the URL field of the Request settings

Once the action is configured, you can click the "Run action" button to test it and see that the function executed successfully:

That's it, now you can connect your action to the component.

Last updated