Amazon’s CloudFront Content Delivery Network (CDN) supplements Amazon’s S3 service by seamlessly caching your content much closer to your website visitors, thus substantially improving speed and latency, while at the same time giving you the additional option of streaming your content (videos, etc) using the RTMP (Flash Media Server) protocol. Sound complicated? It’s really not, read on.
What is Amazon’s CloudFront and how is it different to S3?
You may not realize it, but when you use Amazon’s S3 you first have to create what Amazon calls a “bucket”, which is a basically just the top folder/directory that you will be storing everything under. When you create this “bucket” Amazon asks you where you want this bucket to physically reside. At the time of writing this article, the options were:
- US Standard – which is either North Virginia or the northwest of the USA. You can’t determine which of those datacenters is used, Amazon decides that.
- Northern California
- Ireland
- Singapore
Let’s say you upload a number of MP4 videos to a bucket in Ireland. Your videos are physically in Ireland, so your website visitors from say Australia have to download your videos literally from the other side of the world. Yes they can still download them, but the speed isn’t going to be as fast as say downloading those same videos from Singapore, yet if you have website visitors from all over the world or even just 2 continents, your choice of bucket location could become a dilemma. CloudFront completely elevates all this! CloudFront is an additional service that is an add-on to S3.
CloudFront works by SEAMLESSLY caching the content you have stored in buckets on S3 at “edge” locations so that basically there are copies of your S3 content in physical locations closer to your website visitors. So let’s say you’re using CloudFront for all of your MP4 videos. When someone in Australia tries to view one of your videos, CloudFront will look to see if that video is in the closest “edge” location, in this case Singapore. If it is, the video is downloaded from there. If it’s not, the video is downloaded from either a closer edge location (for example Hong Kong) or from the original S3 bucket location instead (in this example, Ireland). Once CloudFront has received a certain amount of requests for that same video from the same country or region, CloudFront will cache the video at the closest edge location (Singapore in this example). Thus all subsequent requests for that video from that same country or region will be tremendously faster.
Once you’ve setup CloudFront you don’t need to be concerned about edge locations, CloudFront handles it all, you don’t need to specify which edge locations to use, CloudFront determines that all dynamically based on where the requests are coming from and how many.
Where are the CloudFront edge locations?
United States
- Ashburn, VA
- Dallas/Fort Worth, TX
- Los Angeles, CA
- Miami, FL
- New York, NY
- Newark, NJ
- Palo Alto, CA
- Seattle, WA
- St. Louis, MO
Europe
- Amsterdam
- Dublin
- Frankfurt
- London
- Paris
Asia
- Hong Kong
- Tokyo
- Singapore
For the latest locations, see http://aws.amazon.com/cloudfront/#details.
How do you I change my content?
You will change your content as you normally would, just upload the new file(s) to the respective bucket on S3. By default, CloudFront will check for updates to your content every 24 hours, but that is easily changed to 1 hour (for example). You can also “invalidate” a file so that CloudFront will remove it from it’s edge locations immediately.
Content Delivery Options
Amazon’s S3 has one delivery method, HTTP. CloudFront can of course delivery any content/files via HTTP. However, for stream-able content (MP4 and FLV) you ALSO have the option of streaming that content via RTMP, which is the Flash Media Server format.
Why would I want to stream my content via RTMP?
Well, two reasons immediately come to mind. First, your content, let’s say it’s a video, is extremely big/long, and while it can always been delivered via HTTP (progressive download), if your website visitor wants to skip ahead, he/she really can’t do that until the content has been downloaded to the point he/she wants to skip to. In the case of a video 1 hour long, that might be extremely inconvenient. With RTMP the website visitor can just skip as far ahead as he/she wishes, as RTMP delivers your content on-demand. The other reason is less obvious. Whether you realize it or not, when your content is downloaded via HTTP (progressive download), it’s susceptible to being copied. Just go on to YouTube and looked up how to copy a YouTube video using Firefox, it’s very easy. You may not want your content copied, and RTMP HELPS with that, I wouldn’t say 100% elevates it, as I’m sure there’s a way to still copy that, but it certainly makes it very difficult for the vast majority of people to copy.
How much does CloudFront cost?
Just like all of Amazon’s services, CloudFront is quickly and painlessly added without any commitments or contracts. CloudFront’s pricing can be found here http://aws.amazon.com/cloudfront/faqs/#What_is_the_price_of_Amazon_CloudFront.