Download private files directly from Amazon

Created on 30 March 2016, almost 9 years ago
Updated 15 January 2025, about 2 months ago

In this comment https://www.drupal.org/node/2405331#comment-10508194 β†’ , the poster asks:

Is it possible to make the private files download straight from Amazon but still make sure the files are not accessible without drupal authentication?

This would be a great feature for this module. If I understand correctly, at present this module requests the file from S3 and then serves it up via Drupal/PHP (in order to enforce access control). This consumes bandwidth as the file is loaded from Amazon and then consumes bandwidth again as the file is served by Drupal to the user. On top of this Drupal is using server resources as it processes and serves up the files. This also adds all kinds of fun timeout issues that just aren't pretty: Say you are hosting multiple GB files, your PHP/server configuration timeouts will need to allow very long request (hours). None of this is pleasant when Drupal should really be working to serve up webpages.

It appears this can be accomplished by creating a pre-signed URL for the privately hosted files: http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html

A short description about Amazon S3 pre-signed URLs:

All [Amazon S3] objects by default are private. Only the object owner has permission to access these objects. However, the object owner can optionally share objects with others by creating a pre-signed URL, using their own security credentials, to grant time-limited permission to download the objects.

By offloading the entire download process to Amazon, we've just eliminated a pile a headaches for the webserver and Drupal, especially for larger files, the files download faster, the server resources are conserved, and for some servers (e.g. IIS/Windows) this would allow hosting private files that are larger than 2GB.

Do others agree that this would be helpful?

✨ Feature request
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States RogerRogers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    Drupal 7 end-of-life triage:
    Drupal 7 reached end of life on January 5th.

    The 7.x branches of S3FS do not have any additional planned releases.

    Moving this to a feature request in 4.x. This wouldn't be too hard to implement into the file controller to issue a redirect.

Production build 0.71.5 2024