This module is designed to allow Drupal to replace it’s default file system with your S3 bucket. So, when a user uploads files through the Drupal admin interface ( which normally sends files to sites/default/files on your local server ) files automatically wind up in your S3 bucket. The miniature S3 series is a photoelectric sensor basic line offering through beam, retroreflex polarized and proximity models with both red or IR LED emission, also available in radial or axial version with trimmer adjustment, M8 4-pole or 2m cable connection. Models Order Code.
In two previous blog posts I talked about running Drupal 7 on AWS:
- Running Drupal 7 on AWS - part 1: The How & Why
- Running Drupal 7 on AWS - part 2: The CloudFormation stack
Since writing part 2 of this topic AWS has finally released Elastic File System (EFS), so I had to write an update for the stack that uses EFS instead of S3.
Elastic File System (EFS)
EFS is a shared nfs filesystem you can attach to one or more EC2 instances. While we can store our user uploaded content in S3 using the Drupal s3fs module, getting the css and js aggregation cache to work over multiple servers was still an issue with S3.
If we use EFS instead of S3, and share the
sites/default/files directory over every EC2 instance, we remove that problem.
The source code for this stack is on Github:
- drupal7-efs.json: A very minimal Drupal 7 stack setup
- drupal7-efs-realistic: A more realistic Drupal 7 site with a lot of contrib modules. This also uses a Docker hub container image instead of building an image in the Launch Configuration.
I will continue to work on the second one, so you probably want to take that stack.
A short note about this stack and Docker
While this stack uses Docker it is not a complete container management system like ECS is intended to be. Rolling out a new version of a Docker image with this stack is pretty much a manual job: you scale the Auto Scaling Group down to 0 nodes, then scale it up again to the required number. All the new instances that get created that way will have the new version of your Docker image. (or you can scale it up to double the normal size and then scale down again to remove the old instances).
- AWS, Cloud, Drupal, Technology
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 use it only for individual fields.
Amazon S3 vs Amazon CloudFront
Amazon S3 is designed for large-capacity and low-cost file storage in the specific geographical region.The storage and bandwidth costs are quite low. Compared to this, Amazon CloudFront is a Content Delivery Network (CDN) which caches web data at edge locations as close as possible to the user.
- You don’t have to purchase an additional hardware as your space requirements grow.
- You receive secure and managed hosting at very low costs.
- Your server will have an offsite backup in case something goes wrong.
- Ample amount of data can be stored in a bucket.
1. Amazon S3 bucket
2. Composer- Composer installs S3 module dependencies such as AWS SDK
3. S3FS Module: Drupal module is required for getting connected to Amazon S3 bucket.
1. On the terminal, go to the project root folder and execute the following commands:
drush dl s3fs
2. Run the below composer command
composer config repositories.drupal composer https://packages.drupal.org/8 && composer require drupal/s3fs
After running this command, you will get the following screen:
3. drush en s3fs
4. Goto /admin/config/media/file-system and set the “Default download method” checkbox to “Amazon Simple Storage Service”.
5: Add the type File and Image fields in any content type and set the “Upload destination” to “S3 File System” in the “Field Settings” tab.
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.
A- Amazon Web Services Access Key
B- Amazon Web Services Secret Key
C- S3 Bucket Name
Drupal S3 File Storage
After installation, upload your first file by using node creation form. If you are not able to see the uploaded file, it is because your bucket is not yet public. Please go to your bucket, select the s3fs-public folder and then further go to actions and change the status to Public.
Drupal S3 Module
ADDITIONAL FOLDER SETTINGS
If your files exist in another folder inside the root of S3 Bucket, you can enter the folder name in “Public Folder” and “Private Folder” text fields in additional folder setting.
Hope this article gave you a good understanding of S3 File System (Amazon S3) requirements and installation.