{"id":46176,"date":"2017-04-19T11:15:40","date_gmt":"2017-04-19T05:45:40","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=46176"},"modified":"2022-11-25T10:36:03","modified_gmt":"2022-11-25T05:06:03","slug":"s3-bucket-configuration-with-drupal-8","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/s3-bucket-configuration-with-drupal-8\/","title":{"rendered":"S3 Bucket Configuration With Drupal 8"},"content":{"rendered":"<p>Drupal provides both public and private file systems. S3 File System (Amazon S3) provides an additional file system to the <a title=\"Drupal Development Services\" href=\"http:\/\/www.tothenew.com\/wcm\/drupal-development-consulting-services\">Drupal site<\/a>. S3FS module is used to store files in Amazon S3 (Simple Storage Service) or any other S3-compatible storage service. You can configure your Drupal site to use S3 File System as default, or use it only for individual fields.<\/p>\n<p><strong>Amazon S3 vs Amazon CloudFront<\/strong><\/p>\n<p><a href=\"http:\/\/www.tothenew.com\/blog\/amazon-s3-bucket-lifecycle\/\">Amazon S3 is designed<\/a> for large-capacity and low-cost file storage in the specific geographical region.The storage and bandwidth costs are quite low. Compared to this,\u00a0<a href=\"http:\/\/www.tothenew.com\/blog\/cloudfront-monitoring-using-cloudwatch\/\">Amazon CloudFront<\/a> is a Content Delivery Network (CDN) which caches web data at edge locations as close as possible to the user.<\/p>\n<p><strong>Advantages:<\/strong><\/p>\n<ul>\n<li>You don&#8217;t \u00a0have to purchase an additional hardware as your space requirements grow.<\/li>\n<li>You receive secure and managed hosting at very low costs.<\/li>\n<li>Your server will have an offsite backup in case something goes wrong.<\/li>\n<li>Ample amount of data can be stored in a bucket.<\/li>\n<\/ul>\n<p><strong>Requirements:<\/strong><\/p>\n<p>1. Amazon S3 bucket<br \/>\nhttps:\/\/aws.amazon.com\/s3\/<\/p>\n<p>2. Composer- Composer installs S3 module dependencies such as AWS SDK<br \/>\n(https:\/\/aws.amazon.com\/sdk-for-php\/).<\/p>\n<p>3. S3FS Module: Drupal module is required for getting connected to Amazon S3 bucket.<\/p>\n<p>4. Drush<\/p>\n<p><strong>Installation:<\/strong><\/p>\n<p>1. On the terminal, go to the project root folder and execute the following commands:<br \/>\ndrush dl s3fs<\/p>\n<p>2. Run the below composer\u00a0command<\/p>\n<p><code>composer config repositories.drupal composer https:\/\/packages.drupal.org\/8 &amp;&amp; composer require drupal\/s3fs<\/code><\/p>\n<p>After running this command, you will get the following screen:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-46221 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/composer-command.png\" alt=\"composer-command\" width=\"1064\" height=\"379\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/composer-command.png 1064w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/composer-command-300x106.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/composer-command-1024x364.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/composer-command-624x222.png 624w\" sizes=\"(max-width: 1064px) 100vw, 1064px\" \/><\/p>\n<p>3.\u00a0drush en s3fs<\/p>\n<p>4. Goto \/admin\/config\/media\/file-system and set the &#8220;Default download method&#8221; checkbox to &#8220;Amazon Simple Storage Service&#8221;.<\/p>\n<p>5: Add the type File and Image fields in any content type and set the &#8220;Upload destination&#8221; to &#8220;S3 File System&#8221; in the &#8220;Field Settings&#8221; tab.<\/p>\n<p>6: Configure your S3FS module settings for S3 File System. Add your S3 bucket name at \/admin\/config\/media\/s3fs. You can Enter your AWS credentials.<\/p>\n<p>A- Amazon Web Services Access Key<br \/>\nB- Amazon Web Services Secret Key<br \/>\nC- S3 Bucket Name<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-46224 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/S3FS-stting.png\" alt=\"S3FS-stting\" width=\"1254\" height=\"336\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/S3FS-stting.png 1254w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/S3FS-stting-300x80.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/S3FS-stting-1024x274.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/S3FS-stting-624x167.png 624w\" sizes=\"(max-width: 1254px) 100vw, 1254px\" \/><\/p>\n<p><strong>\u00a0File Upload:-<\/strong><\/p>\n<p>After installation, upload your first file by using\u00a0node creation form.\u00a0If you are not able to\u00a0see the uploaded file, it is because your bucket is not yet public. Please\u00a0go to your bucket, select the s3fs-public folder and then further go to actions and change the status to Public.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-47575 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/s3public.jpg\" alt=\"s3public\" width=\"1216\" height=\"673\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/s3public.jpg 1216w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/s3public-300x166.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/s3public-1024x566.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/s3public-624x345.jpg 624w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/p>\n<p><strong>ADDITIONAL FOLDER SETTINGS<\/strong><br \/>\nIf your files exist in another folder inside the root of S3 Bucket, you can enter the folder name in &#8220;Public Folder&#8221; and &#8220;Private Folder&#8221; text fields in additional folder setting.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-47577 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/04\/S3FS_additional_setting.png\" alt=\"S3FS_additional_setting\" width=\"1182\" height=\"260\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/04\/S3FS_additional_setting.png 1182w, \/blog\/wp-ttn-blog\/uploads\/2017\/04\/S3FS_additional_setting-300x65.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/04\/S3FS_additional_setting-1024x225.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/04\/S3FS_additional_setting-624x137.png 624w\" sizes=\"(max-width: 1182px) 100vw, 1182px\" \/><\/p>\n<p>Hope this article gave you a good understanding of S3 File System (Amazon S3) requirements and installation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Drupal provides both public and private file systems. S3 File System (Amazon S3) provides an additional file system to the Drupal site. S3FS module is used to store files in Amazon S3 (Simple Storage Service) or any other S3-compatible storage service. You can configure your Drupal site to use S3 File System as default, or [&hellip;]<\/p>\n","protected":false},"author":1514,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":25},"categories":[1174,4308,3602,1],"tags":[4542,4541,2937,1332,4862,3601,3603],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/46176"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1514"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=46176"}],"version-history":[{"count":1,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/46176\/revisions"}],"predecessor-version":[{"id":55848,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/46176\/revisions\/55848"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=46176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=46176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=46176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}