- Published on
Amazon s3 alternative
- Authors
- Name
- Omer Atagun
We all need an object storage for storing static images or user uploaded images. For quite sometime, i preferred having a pretty cheap virtual server where i have custom application that allowed me to upload user or my static content. At some point, it was problem to maintain. Increasing storage, having health checks is just overhead on entire ecosystem.
I have been using Contabo for over 5 years already. For some time they had their own service called contabo object storage. Luckily they have created the system that is identical to amazon s3.
To take a look Contabo Object Storage.
Immediately i wanted to get one for myself for an actually €2.49 a month for 250gb storage ( no traffic limit ). Wanted to test it out and found myself quickly in Laravel's s3 environment variables.
Beauty is that, you get UI access where you can invite your users based on authorization to allow them read write etc. So anyone from the team can also update some static image.
After the installation for s3 Storage driver of Laravel file system / cloud storage,
AWS_ACCESS_KEY_ID=contaboaccesskey
AWS_SECRET_ACCESS_KEY=contabosecretaccesskey
AWS_DEFAULT_REGION=eu2
AWS_URL=https://eu2.contabostorage.com/d839smddfkiokf0183kmdf:mybucket ( this is bucket )
AWS_ENDPOINT=https://eu2.contabostorage.com
AWS_BUCKET=mybucket
AWS_USE_PATH_STYLE_ENDPOINT=true
This is pretty much all to do to arrange your contabo object storage configuration in laravel.
In usage, all you have to do is to call the disk. You can change in config/filesystem the name of your disk or duplicate with contabo service if you please to.
Storage::disk('s3')
->put('avatars/$fileName . $fileExtension, \GuzzleHttp\Psr7\Utils::tryFopen($file,'r'));
You have got yourself a low cost object storage that can be used on development, staging and even in low traffic projects ( have not tested in heavy traffic but i guess it will be fine. )
Bonus:
- They have their own client application where you can create or manage your buckets, instances as well as api documentation.