So you’re convinced that a Content Delivery Network ( CDN ) would be a huge benefit to your site (if you’re still on the fence just read this first) and you are unsure of how to integrate it. How to integrate a CDN into your site depends very much on your needs.
The first thing you will need to establish is whether to use http progressive download or true streaming. If you are serving images via the CDN or providing downloads (zip files, exe files or media files for download) then http (or ‘progressive’) download is the mode most suitable, if your app streams audio or video to users then true streaming is optimal. Http download simply dumps the max output possible on the user requesting the file whereas true streaming sets up a two way communication between the requestor and the server which allows for optimizing the stream to fit the user’s bandwidth and provides more intelligent features such as seeking to a point in the file (these features do not need to be implemented by the developer they should be available out-of-the-box with most media players).
Amazon CloudFront
If you are using Amazon CloudFront then your starting point will be the Simple Storage Solution (S3) which is the static storage component of Amazon Web Services, to upload your files to S3 from your application you will need to use S3′s REST API although some CMS’s do have integrated S3 upload capabilities (see Using S3 in WordPress). Amazon doesn’t provide a GUI to upload files to so you will need to use a third party tool – Jungle Disk provides upload to S3 although it is more of a backup solution than a file manager, S3 Fox Firefox plugin as an efficient S3 uploading and file management tool, in addition CloudBerry FileExplorer is a full featured desktop app for managing S3 and CloudFront files.
Any file stored in S3 can be served from AWS’s CloudFront CDN. To use CloudFront you are required to sign up for it separately to S3 (you can sign up here) Files served by CloudFront must exist in S3 and when a file is requested from CloudFront, CloudFront initially requests the file from S3 and then caches it at one of its edge locations. Once you have an account at CloudFront, login to the AWS Management Console and navigate to the CloudFront tab. Under a single CloudFront account you can have various Distributions which are essential ‘buckets’ of storage which can have different attributes. Click the Create Distribution button which will open the setup dialog, then select either to use http download mode or true streaming, and associate the Distribution with an S3 bucket.

Once the Distribution is created, you will be given a unique domain which will look similar to dxabw2ae51eqo.cloudfront.net , to request your files from CloudFront instead of S3 simply replace your S3 domain (in the format bucket_name.s3.amazonaws.com) with your CloudFront domain on all your file URL’s – the file names will remain unchanged.
Other CDNs
There are several other popular CDN’s such as CloudFiles, MaxCDN, SimpleCDN. In essence they work in exactly the same way – you are required to use a custom API if you want to implement uploading to the CDN from your app or you can upload the files manually and then link to from your app. Most of these provide an online file explorer which allows you to upload and manage files although there is not the same number of third party file management tools as for S3/CloudFront.
If you are using WordPress you can use several plugins to facilitate file serving from a CDN , notably W3 Total Cache allows you to specific any CDN to serve files from. CDN Tools is a plugin dedicated to the CloudFiles CDN which provides very tight integration between the WordPress file upload and the CDN.
See our CDN Pricing Comparison for pricing details.