How to Integrate Amazon S3 with Drupal: A Step-by-Step Guide

About the Author

Omar Alahmed

Director of Engineering

Omar Alahmed is the Director of Engineering at Vardot, with nearly twenty years of Drupal experience ranging from version 5 to the current core. He specializes in enterprise platforms for higher education, government, NGOs, and mission-driven organizations worldwide, with a core focus on blending optimized performance, robust security, and SEO with strict digital accessibility.

FAQs

Yes. The S3 File System module (s3fs) supports Drupal 10 and Drupal 11 on its current 8.x-3.x branch. It installs through Composer, which automatically pulls in AWS SDK for PHP v3 as a dependency. The module requires allow_url_fopen = On in your PHP configuration and the cURL library so the SDK can communicate with S3.

In most cases, keep aggregated CSS and JS served locally for lower latency, and use S3 for media assets like images, video, and downloads. Since Drupal core 10.1, aggregated CSS/JS use a separate assets:// stream wrapper, so storing them on S3 requires the companion S3 File System for assets module rather than the core s3fs configuration.

Yes. The S3 File System module manages private files when you enable s3fs.use_s3_for_private and s3fs.upload_as_private in settings.php, and it can issue presigned URLs for time-limited access. When public and private files share one bucket, configure the schemes carefully a past s3fs security advisory involved access bypass between filesystem schemes stored in the same bucket.

Yes. The S3 File System module works with any S3-compatible object storage, including MinIO, DigitalOcean Spaces, and Backblaze B2, not just Amazon S3. You point the module at the provider's endpoint and supply that provider's credentials. This makes s3fs a practical option for teams with data-residency requirements or an existing non-AWS storage contract.

Amazon S3 integration matters most for Drupal sites load-balanced across multiple servers, where Drupal's default local file system can't keep files synchronized between nodes. Storing media in a central S3 bucket solves that synchronization problem, offloads storage from web servers, and,  when paired with a CDN such as CloudFront,  improves media delivery speed for global audiences.

Join the conversation +