Laravel: How to use Linode's Storage Object as an alternative to AWS S3 in PHP?
Linode's Object Storage is marked as being S3 compatible. Knowing this I thought that I can simply use Linode's credentials in my filesystems.php
and use ->disk('s3')
to upload and download files but apparently this is not the case.
I have installed all required S3 PHP packages as suggested in Laravel's docs.
My .env
has:
AWS_ACCESS_KEY_ID=foo
AWS_SECRET_ACCESS_KEY=bar
AWS_DEFAULT_REGION=DE
AWS_BUCKET=my-linode-storage-object.eu-central-1.linodeobjects.com
In logs I get exception to Could not resolve host
. It tries to concatenate AWS endpoint with what I provided above so no-brainer that it doesn't work. Should I install completely different package to handle Linode's Storage Object connections?
I don't see much tutorials on the web on how to use Linode's Storage Object in Laravel apps. Any links or hints would be appreciated.
2 Replies
You need to provide the S3 driver with the authentication URL.
For DE, this is: eu-central-1.linodeobjects.com
So your .env should be (note a few changes):
AWS_ACCESS_KEY_ID=foo
AWS_SECRET_ACCESS_KEY=bar
AWS_DEFAULT_REGION=eu-central-1
AWS_BUCKET=my-linode-storage-object
AWS_ENDPOINT=eu-central-1.linodeobjects.com