I have the following code as part of a backend sample for generating download links which are valid for 15 minutes.
$url = "{$bucket}/{$key}";
$request = $this->s3Client->get($url);
return $this->s3Client->createPresignedUrl($request, '+15 minutes');
From what I understand, this makes a web request to Amazon, and I need to generate about 20-30 download links per pageload.
So how would I go about not abusing the Amazon API, while still allowing clients to download files? The 2 options I could think of are:
What I'm interested in is:
This is a non-issue, because creating a pre-signed URL with the AWS SDK for PHP does not make a request to AWS. You may also find that the S3Client::getObjectUrl()
method is easier to use, since it is an abstraction of what you are doing now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.