Implementing Amazon S3 Service

For the last years on MyPraize, the Christian Social Network we have been serving images from the local disk(s).  This has not only proven to be cumbersome, but expensive!

Last year in August to combat all of the trouble with large bandwidth nights, we moved all MP3's to Amazon's S3 service.  This is basically a CDN (Content Delivery Network) and then we started serving the media from a sub domain that we CNAME'd to the Amazon URL.  All requests to media.mypraize.com are actually coming from Amazon's service, from one of their multiple replicated data centers across the world.

Before the next move, off of the dedicated servers and into the Cloud, we are forced to also upload all of the 300,000 profile images we have, as well as 1,200,000 photo album images and lastly almost 500,000 video thumbnail images.  All of these will have to be served from S3, and then the sites files are be basically any where in the world.

The site up loads the images to S3 as soon as the user uploads the photos, so instead of keeping TB's of data storage on the dedicated server(s), we can now keep a LEAN, and mean RAID setup with just two drive for each web server with smaller SCSI drives.

Also, we have the opportunity to move into the Cloud which is in the plans for this summer.  The benefit being, we can add virtual servers, and copy over site script files in less then 2 minutes and add another server to the web cluster to handle more traffic on demand, and then drop the server when we're done with it.

So thing brings us to our problem!

I have thousands of places where I am calling the images from "mypraize.com/images/comprofiler/" and NOT S3's CNAME'd URL.  Now, I did make a couple code switches just to see how I'd like it, and it's awesome, so, what's the plan of attack?  You got it, change the HTACCESS to use a 301 redirect (for Google's sake too) to point to the new profileimg.mypraize.com sub domain which is CNAME'd back to a different bucket on S3. Then poof, all images will be served from the right location and no need to change a million lines of code (yes, POOF, is a technical term).

RewriteRule ^old_dir(.*)$ http://www.example.com/new_dir$1 [R=301,L]

Say Hello

Near the Cleveland, Akron or Medina area and want to stop by our office? Let us know and we'll get the coffee and whiteboards ready. :)