AWS API
Last updated
Last updated
© 2024 UI Bakery
Using AWS API Connection it is possible to interact with different AWS services that support access via HTTP API and Signature V4 signing.
An example of such request could be a creation of an S3 bucket. Below you can find the steps needed to implement this use-case in UI Bakery.
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 "S3" in the search bar. In the search results select "AmazonS3FullAccess" 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. For more information please refer to this AWS doc.
Review the details of your new user and click the "Create user" button.
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.
In your UI Bakery organization, go to Datasources tab, and click "Connect Datasource" button. Once there, select AWS API 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 you want to create your bucket, for instance, us-west-2
. As the service name use s3
.
Click Test Connection, and Connect Datasource to create your AWS API datasource.
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.
According to AWS S3 API, in order to create an S3 bucket, you need to send a PUT request to https://<your-new-bucket-name>.s3.<your-aws-region>.amazonaws.com with the body containing the following XML (replace LocationConstraint contents with your region) in HTTP request body:
The action in UI Bakery should look as follows:
Once the action is configured, you can click "Execute action" button to test it and check S3 that the bucket was successfully created.
You can set the bucket name dynamically in the URL field based on the value of some input. For more information, please, read about variables.
That's it, now you have an action that can create an S3 bucket.