Is it appropriate to use Linode object storage for web app back ends?
Hi,
I haven an application idea where a storage backend to store files would be convenient. It would also be very interesting to let the users of the web app upload and download files from the storage cluster directly.
Linode Object storage might look as a good option here. If I let my web app create pre signed URLs then users could upload and download directly to the Linode object storage.
Is this a use case that sounds reasonable? Sure aws S3 supports this but I would rather use Linode if. Possible.
Only downside seems to be that for the moment LOS is only available in us east and not in Europe
Thanks,
Pieter
9 Replies
Hi Pieter,
This is a really good question, and I'm glad you asked it in a public forum so that others who are wondering the same thing can see the answer.
Simply put, yes. This is definitely an appropriate use case for our Object Storage, and you're welcome to use it as such.
Here is a link to our section of guides on Object Storage that you might find useful:
In regard to our Object Storage not being available in Europe yet, it should be fairly soon. Keep an eye on our blog for updates.
@dubidub We have documentation on how to create them with the Linode API. You can do this them using our API endpoint. You can also uses s3 API, or the Linode CLI. Keep in mind that these pre-signed links will have an expiration date.
I hope that helps!
I created pre-signed URL by using Linode Object Storage API.
After that, I can't find any document to create a new object using the presigned_url.
By using Linode CLI, I created an object in bucket.
But in PHP project, it doesn't work.
Please let me know any solution you have.
thanks.
@lawhq_mp - To assign a new object to the pre-signed URL, you would need to change the method to a different HTTP method parameter. The example from our API docs is as follows:
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X POST -d '{
"method": "GET",
"name": "example"
}' \
https://api.linode.com/v4beta/object-storage/buckets/us-east-1/example-bucket/object-url
You would just change the method in that code block and replace the examples with your token information and URL. To upload an object to your newly created URL, you would change that method to PUT. If you're using PHP, you may find this resource to be helpful.
@jyoo - thank you for your reply.
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X POST -d '{
"method": "PUT",
"name": "example"
}' \
https://api.linode.com/v4beta/object-storage/buckets/us-east-1/my_bucket/object-url
If I execute the above again, how can I create a new object data content?
I mean where is the data content param and the created pre_url.
Once I use Linode-cli:
linode-cli obj put --acl-public example.txt my_bucket
there is the datacontent: example.txt
If it works on your side, could you please explain again?
thanks.
@lawhq_mp - Adding the content would work the same way as adding content without a pre-signed URL. If you're starting with an existing object, you would pass the object name as a parameter under "name" and the output would be the corresponding pre-signed URL for that object. If you're creating a pre-signed URL prior to the creation of the object, you would pass the anticipated name of the object under "name" and add the object under that name once created.
I wasn't able to replicate creation of a pre-signed URL for a non-existent object. I can't verify whether this is because of user error or because this feature in the API endpoint is under construction, as this endpoint is currently in beta. I've reached out to our team for clarification, since our API guide does state that the named object does not need to exist for pre-signed URL generation.
There are a couple of workarounds in the meantime. You can create the object prior to creating the pre-signed URL. You can also utilize the S3 API; that documentation can be found here.
thank you. Once you solved this issue to upload the new object using Object Storage API, please let me know it.
one more question.
Can I use AWS PHP SDK to upload a new file on Linode Object Storage?
I am not sure if we could use this Object Storage bucket service now.
Please let me know it clearly.
Thank you.