S3 File System (s3fs) provides an additional file system to your drupal site, which stores files in Amazon's Simple Storage Service (S3) or any other S3-compatible storage service. You can set your site to use S3 File System as the default, or use it only for individual fields. This functionality is designed for sites which are load-balanced across multiple servers, as the mechanism used by Drupal's default file systems is not viable under such a configuration.

Dependencies

7.x-2.x

S3 File System uses the Libraries module to access the AWS SDK for PHP 2.x library. S3 File System's README.txt file gives detailed instructions for the SDK's installation. Please note that AWS SDK for PHP 3.x is not compatible with S3 File System. You must install the 2.x version of the SDK. The README includes specific instruction to this effect.

7.x-3.x

Composer manager will use the included composer.json file to pull in and autoload the latest 3.x version of the AWS PHP SDK.

8.x-2.x

AWS SDK version-3. If module is installed via Composer it gets automatically installed.

Additional Requirements

Your PHP must be configured with allow_url_fopen = On in your php.ini file. Otherwise, PHP will be unable to open files that are in your S3 bucket.

In addition, you need the php5-curl library installed for the SDK to be able to communicate with S3. Most hosts will already have this library installed, but some don't.

Companion Modules

  • If your users need to upload very large files to your site, you might want to use the S3FS CORS Upload module. It enables CORS-based uploads, allowing files to be uploaded directly to S3, rather than being routed through your server.
  • S3FS Migrate aids in converting a site that's currently storing its media files on the local filesystem into a S3-backed site.
  • S3FS File Proxy lets you easily configure your site to allow existing hard-coded URLs to files continue to work once the files have been migrated to S3.

Project Notes

Special recognition goes to justafish, author of the AmazonS3 module. S3 File System started as a fork of her great module, but has evolved enormously since then, becoming a very different beast. The main benefit of using S3 File System over AmazonS3 is performance, especially for image-related operations.

Known Issues Drupal-7

It has recently come to light that eAccelerator, a deprecated opcode cache plugin for PHP, is incompatible with AWS SDK for PHP. eAccelerator will corrupt the configuration settings for the SDK's s3 client object, causing a variety of different exceptions to be thrown. If your server uses eAccelerator, it is highly recommended that you replace it with a different opcode cache plugin, as development on eAccelerator ended in 2012.

If you see the error message "Upload a new file field is required" when uploading a file, you'll need to update your Drupal Core to the latest version. This is caused by a bug in Core that was fixed in mid 2015.

Supporting organizations: 
D8 porting

Project Information

Downloads