s3fs module adds a additional file storage with the stream
s3://. By default Drupal provides 2 streams
After installing this module you should see and additional option labeled Amazon Simple Storage Service or S3 File System
Managing public files
Two options are available for public files
Option 1 - Default
This option gives more granular control but requires you to set the system to use S3 storgae` where you want. You would need to update the configuration on these screens
- Text format:
/admin/config/content/formats/manage/<format name>. For example
admin/config/content/formats/manage/full_htmlwhere formal is
- FIle settings:
/admin/config/media/s3fsto update the Default download method
- Image field settings: eg:
/admin/structure/types/manage/article/fields/node.article.field_image/storage. This is required for every file field.
The disadvantage here is that you are required to update general system configurations, text formats storage and all file fields separately. Other modules using the public file would also need to be updated separately.
Option 2 - Use S3 for all public files
This option automatically use
S3 for all public files. Saving you the need to reconfigure different settings.
To do this you should update the
settings.php as below
$settings['s3fs.use_s3_for_public'] = TRUE;
This change the first option on setting page
Public local files served by the webserver. to
Public files served from Amazon S3
This options has some disadvantages. S3 is used for processing all public files and this affects php twig files. You should change your php twig storage folded to a local directory, php twig files in S3 produce latency and security issues (these files would be public). You must change the php_storage settings in your setting.php and choose a directory, out of docroot recommended.
Update you settings.php to something like this
$settings['php_storage']['twig']['directory'] = '../storage/php';