Calls to AWS APIs

Hey everybody…

Still experimenting bubble… but I was wondering how do I do to start making calls to AWS API and return things like list of instances, s3 files (private) etc. Can anybody share your experience?

Tks

Hey, Scharan!

For dealing with more complex calls to AWS API, I’ve used the API Gateway and AWS Lambda.

For AWS S3, its not so complicated:

Not sure how to generate SHA keys in bubble but you can probably run javascript on the page for that (for running auth with S3) or just supply IAM role credentials.

@andersan by the way…

Where are you passing your IAM credentials? What are you passing on the file value as { ‘test’:‘test’}?

Still starting with Bubble so looking at your print I still have some questions

Here the bucket is public so there’s no need to pass IAM credentials.

The ‘test’:‘test’ values for the file were just used to “initialize” the API call in bubble. What is uploaded here is a JSON post that 1) starts an EC2 instance (due to the Event caused by the post) and 2) is used as an input to a program in that EC2 instance.

Using the SDK directly from bubble could be difficult. You can’t control the code run on the Bubble server, and Bubble works best with API calls (vs functions run from a node library like the AWS node library).

Yes… that’s kinda what I was thinking… SDK works directly with the code.

About the S3, how would you setup for a private bucket?

Tks @andersan

Not sure as I haven’t done it before. You probably need to supply your api key and generate a signature from a secret key (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationRequestCanonicalization). Considering you can’t run custom javascript on the server side, you’d need to generate these auth credentials on an external service, like a webtask…

Seems overly complicated, maybe someone else has a better solution - I know other people have made apps integrating with S3 in the past and probably other AWS services.

I am actually trying to GET data from the API gateway so I can use it in a bubble app. Is this all I would need to do this or would I still need SHA keys or is that just an S3 thing? Is there a way to authenticate to get private data?

Not sure - right now, all of the API gateways I’ve set up to work with Bubble are open to the public.

You’ll want to look into how to authenticate with the api gateway if you are getting sensitive data. Maybe this link is helpful https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-to-api.html . There are a lot of ways to authenticate with AWS, but SHA keys seem to be the simplest way to do so.

Okay.

The screenshot you posted above, what interface is that. Is that a special screen in Bubble? I’m currently on the free version, so maybe I don’t have access to that yet.

Its the API Connector, which you can install through the plugins tab.

I’m not sure if its available on the free version of Bubble.

Just to give you guys an update… What I end up doing was a serverless API using API Gateway and Lambda. So my Bubble Workflow would make a POST to my API Gateway that will trigger my Lambda function that will get the AWS resources info that I need using AWS SDKs.

It is not the best solution but is the faster, and on my case all of my calls are asynchronous… so the user doesn’t have to wait for the info. I hope it makes sense…

1 Like

Yeah, I think makes sense to me (I’m really new to all this). Are you using Postman at all? I’ve heard some other people using that, but I don’t quite understand how that fits in with Bubble.

1 Like

Oh, thanks! Yep, I can use that on the Free version

1 Like

Thanks for the update! Will keep this in mind in case I ever need to use the SDK. Haven’t used S3 or EC2 for clients on Bubble. Are you using S3 as a database instead of the bubble DB?

Awesome, Glad to hear it.

Postman is good for testing API calls. You can use it to set up the same API Gateway call that you want to implement in Bubble, as the UI is a little easier and it should help you get everything set up.

Chris
AirDev - Custom Software for Everyone

Hi, Scharan! I think the Bubble DB is slow, so I am considering connection it to an AWS. Did you try that out? If so, any experience with the speed vs the standard bubble DB?

Thanks!

Br, Endre

1 Like

This screenshot was extremely helpful!

Although, there must be something I don’t understand.

Using this method, can you not use a URL as the ‘file’ and have the URL upload into the s3 bucket?

I’m just trying to get files converted from CloudConverts API to post into S3.

Ironically, my users are uploading into S3, I’m passing their files to Cloud Convert to be zipped, then trying to pass that zipped folder back to S3.

EDIT:
When I attempted to enter a URL using the ‘file’ key, I get a definitely not correct zip file of only 73 bytes.

I’m digging through POSTObject reference but can’t seem to figure this out.

Using a URL as a file to upload to S3 does not work. S3 will expect binary data or the file’s plain text. Plain text input is only supported if it is a plain text file.

If the Bubble API connector call is passing a parameter of type “file”, I think that should work. For the screenshot here, I was just uploading a plain text file (it was actually a JSON), so the call would look different for a different for images, zip files, etc.

1 Like