REST APIs for Generating presigned R2 URLs?

Hey there, I have a fairly simple use case where I would like to use a REST API call to generate a pre-signed URL for R2, which allows to upload a specific filename.

I looked through the documentation but the closest thing I find to do that is using AWS cli

Is it possible to avoid using the cli and generate a pre-signed URL simply using REST?

For the record, I ended up using the boto3 aws python library, but I still think it would be useful to know if this is possible.

What would be the intended use case?

SDKs are, even on AWS S3 itself, usually the way to go, as the raw REST calls tend to get rather complicated if you have to account for all the possible cases. AWS does provide an SDK for a whole number of different languages, if Python isn’t your best choice.

There’s always cases where a REST API is the easiest option. I just want to know if it’s possible.

Presigned URLs are exclusively an S3 API concept and so only exist in the S3 API.

You can use aws4fetch (JS), aws-sdk-??? for any given language or CLI tools like rclone / awscli.

1 Like

You cloud simply trace what the SDK is doing…
I was in a similar position a while back, and quickly fell back to the SDK.

But here’s the official AWS S3 doc, which by all means would yield compatible results for R2. Enjoy, I guess? :upside_down_face: