I'm looking for a good solution to get the signed url from amazon s3.
I have a version working with it, but not using laravel:
private function getUrl ()
{
$distribution = $_SERVER["AWS_CDN_URL"];
$cf = Amazon::getCFClient();
$url = $cf->getSignedUrl(array(
'url' => $distribution . self::AWS_PATH.rawurlencode($this->fileName),
'expires' => time() + (session_cache_expire() * 60)));
return $url;
}
I don't know if this is the best way to do with laravel, considering it has a entire file system to work...
But if don't have another way, how do I get the client? Debugging I've found an instance of it inside the Filesystem object, but it is protected...
For Laravel 5.5 and up, you can now use temporary URLs/s3 presigned URL.
This only works for s3 storage driver AFAIK.
https://laravel.com/docs/5.5/filesystem#retrieving-files
the above explain answer (@brian_d) is ok, but it takes too much time to generate presigned url. i wasted almost 4-5 days to overcome that. finally following worked for me. Thanks to @Kenth.
In Laravel,
Make sure you have the AWS for flysystem composer package too (version will vary):
After lote of bugs, at last, I found the solution of accessing private content of s3 bucket using below code:-