Simple CDN with Media Mover and S3

Updated 10/26/09: added improved url rewriting rules

So you want an easy to setup CDN that does not require much work and integrates with Drupal. Here is a quick setup to get to serve assets automatically from your Drupal files directory from S3

What you need:

  • Drupal site
  • Media Mover
  • S3 account

Get started
Install Media Mover, enable the S3, Directory, and AutoRun modules on your admin/build/modules page. Go to admin/settings/media_mover and enter your S3 credentials.

Media Mover

S3 without PEAR

I just ran across this which looks like I can potentially cleanup one of the annoying issues that the S3 implementation that Media Mover uses.

Currently, when Media Mover goes to push a file to S3, it has to run the full file through memory, demanding a much higher memory overhead each time you want to move a file. This can mean going above 100mbs for PHP which is not exactly possible on shared hosts.

I'm going to try some implementation with it and see how things go. Hopefully this will significantly improve S3 performance.